Expand description
This crate offers a SymbolTable type which can store strings as
lightweight [Symbols], which enable extremely fast comparison and total
order operations. Depending on the backing data structure, the SymbolTable
may also offer fast convertion from Symbol to String. Finally, Symbol
is parameterized by a type, allowing you to intern strings coming from
incomparable sources without the possibility of mixing them up.
For example, if you intern an Address: Into
Structs§
- Symbol
- A Symbol uniquely represents each String contained in the [SymbolTable]. It serves as a lookup key into the table, allowing anyone holding a Symbol to recover the interned value, or to compare the interned value against other interned values of the same type. These comparisons are O(1).
- Symbol
Iterator - Symbol
Table - A SymbolTable allows you to store items according to their String representation in a lookup table. The lookup table typically compresses the strings to save space on large tables. The SymbolTable provides a handy, opaque ID for each entry in the table, called a Symbol. This Symbol allows for O(1) comparison of strings because the table is responsible for encoding string uniqueness into each id.
- Table
Mismatch Err - ResolutionErr occurs when a [Symbol] is resolved on a [SymbolTable] from which it did not originate. If a user creates two separate [SymbolTable]s, a [Symbol] from one table is not available to be resolved by the other table. If a user attempts this, a ResolutionErr is returned, indicating that the identities of the two tables are different.
Enums§
Traits§
- Internable
- A type is Internable if it supports conversion to and from String, and it is static. It doesn’t always need to be parsable from a string, but the output of .toString() must be parsable by TryFrom()
- Interner
- Interner is a backing store for the [SymbolTable]. It is responsible for implementing [Symbol] uniqueness and String compression. You can provide your own interner, or use one of the provided implementations. Most users should expect to use one of the implementations provided by this library. You should only expect to implement Interner yourself if the compression algorithms are not suitable for your needs.