Crate spinoso_symbol

Source
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-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.

Structs§

Enums§

Traits§

Functions§

  • 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.