Crate spinoso_symbol[][src]

Expand description

Identifier for interned bytestrings and routines for manipulating the underlying bytestrings.

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 bytestring. Activating this feature also activates the ident-parser feature.
  • ident-parser - Enables a parser to determing the Ruby identifier type, if any, for a bytestring. 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

AllSymbolsartichoke

An iterator that returns all of the Symbols in an interner.

Inspectinspect

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

Error returned when a symbol identifier overflows.

Enums

CaseFoldartichoke

Unicode case folding strategies.

Valid types for Ruby identifiers.

Traits

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

Functions

ascii_casecmpartichoke

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.