Crate spinoso_symbol[][src]

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.


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-core and focaccia dependencies. 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 bstr and scolapasta-string-escape dependencies.
  • std - Enables a dependency on the Rust Standard Library. Activating this feature enables std::error::Error impls on error types in this crate.



An iterator that returns all the Symbols in an interner.


An iterator that yields a debug representation of a Symbol and its byte contents as a sequence of chars.

Error type for returned when a folding scheme could not be resolved in a TryFrom implementation.

Error type returned from the FromStr implementation on IdentifierType.

Identifier bound to an interned byte string.

Error returned when a symbol identifier overflows.



Unicode case folding strategies.

Valid types for Ruby identifiers.


Extension trait to return an iterator that returns all symbol identifiers stored in an interner as Symbols.



Compare the byte contents of two symbols using ASCII case-insensitive comparison.

Compare the byte contents of two symbols using Unicode case-folding comparison for equality.