pub struct SymbolTable<const N: usize = DEFAULT_N_SHARDS, S = DeterministicHashBuilder> { /* private fields */ }
Expand description

A table in which you can intern strings and get back Symbols.

The table is sharded N times (default DEFAULT_N_SHARDS) for lower contention when accessing concurrently.

Implementations

Creates a new SymbolTable with the default generic arguments. This symbol table will be determinisitic, using a seeded ahash.

Intern a string into the SymbolTable.

Note how this method only takes &self, so it can be used concurrently.

Interning the same string will give the same symbol.

let mut table = symbol_table::SymbolTable::new();
assert_eq!(table.intern("foo"), table.intern("foo"));

Resolve a symbol to the interned string.

The resolved string is immutable and will live as long as the SymbolTable.

let mut table = symbol_table::SymbolTable::new();
let foo = table.intern("foo");
assert_eq!(table.resolve(foo), "foo");

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.