Expand description
Identifier for interned byte strings and routines for manipulating the underlying byte strings.
Symbol is a Copy type based on u32. Symbol is cheap to copy, store,
and compare. It is suitable for representing indexes into a string interner.
§Artichoke integration
This crate has an artichoke Cargo feature. When this feature is active,
this crate implements the Symbol API from Ruby Core. These APIs require
resolving the underlying bytes associated with the Symbol via a type that
implements Intern from artichoke-core.
APIs that require this feature to be active are highlighted in the documentation.
This crate provides an AllSymbols iterator for walking all symbols stored
in an Interner and an extension trait for constructing it which is
suitable for implementing Symbol::all_symbols from Ruby Core.
This crate provides an Inspect iterator for converting Symbol byte
content to a debug representation suitable for implementing
Symbol#inspect from Ruby Core.
§no_std
This crate is no_std compatible when built without the std feature. This
crate does not depend on alloc.
§Crate features
All features are enabled by default.
- artichoke - Enables additional methods, functions, and types for
implementing APIs from Ruby Core. Dropping this feature removes the
artichoke-coreandfocacciadependencies. Activating this feature also activates the inspect feature. - inspect - Enables an iterator for generating debug output of a symbol byte string. Activating this feature also activates the ident-parser feature.
- ident-parser - Enables a parser to determine the Ruby identifier type,
if any, for a byte string. Dropping this feature removes the
bstrandscolapasta-string-escapedependencies. - std - Enables a dependency on the Rust Standard Library. Activating
this feature enables
std::error::Errorimpls on error types in this crate.
Structs§
- AllSymbols
- An iterator that returns all the Symbols in an interner.
- Inspect
- An iterator that yields a debug representation of a
Symboland its byte contents as a sequence ofchars. - NoSuch
Case Folding Scheme artichoke - Error type for returned when a folding scheme could not be resolved in a
TryFromimplementation. - Parse
Identifier Error - Error type returned from the
FromStrimplementation onIdentifierType. - Symbol
- Identifier bound to an interned byte string.
- Symbol
Overflow Error - Error returned when a symbol identifier overflows.
Enums§
- Case
Fold artichoke - Unicode case folding strategies.
- Identifier
Type - Valid types for Ruby identifiers.
Traits§
- Interner
AllSymbols - Extension trait to return an iterator that returns all symbol identifiers
stored in an interner as
Symbols.
Functions§
- ascii_
casecmp - Compare the byte contents of two symbols using ASCII case-insensitive comparison.
- unicode_
case_ eq - Compare the byte contents of two symbols using Unicode case-folding comparison for equality.