Crate arc_string_interner[−][src]
Expand description
Caches strings efficiently, with minimal memory footprint and associates them with unique symbols. These symbols allow constant time comparisons and look-ups to the underlying interned strings.
Example: Interning & Symbols
use arc_string_interner::StringInterner;
let mut interner = StringInterner::default();
let sym0 = interner.get_or_intern("Elephant");
let sym1 = interner.get_or_intern("Tiger");
let sym2 = interner.get_or_intern("Horse");
let sym3 = interner.get_or_intern("Tiger");
assert_ne!(sym0, sym1);
assert_ne!(sym0, sym2);
assert_ne!(sym1, sym2);
assert_eq!(sym1, sym3); // same!Example: Look-up
let mut interner = StringInterner::default();
let sym = interner.get_or_intern("Banana");
assert_eq!(interner.resolve(sym).map(|s| (&*s).to_string()), Some("Banana".to_owned()));Structs
Caches strings efficiently, with minimal memory footprint and associates them with unique symbols. These symbols allow constant time comparisons and look-ups to the underlying interned strings.
Symbol type used by the DefaultStringInterner.
Traits
Types implementing this trait are able to act as symbols for string interners.
Type Definitions
StringInterner that uses Sym as its underlying symbol type.