Struct arc_string_interner::StringInterner [−][src]
pub struct StringInterner<S, H = RandomState> where
S: Symbol,
H: BuildHasher, { /* fields omitted */ }
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.
Implementations
Creates a new empty StringInterner.
Creates a new StringInterner with the given initial capacity.
Returns the number of elements the StringInterner can hold without reallocating.
Reserves capacity for at least additional more elements to be interned into self.
The collection may reserve more space to avoid frequent allocations.
After calling reserve, capacity will be greater than or equal to self.len() + additional.
Does nothing if capacity is already sufficient.
Creates a new empty StringInterner with the given hasher.
Creates a new empty StringInterner with the given initial capacity and the given hasher.
Interns the given value.
Returns a symbol to access it within this interner.
This either copies the contents of the string (e.g. for str) or moves them into this interner (e.g. for String).
Returns the string slice associated with the given symbol if available,
otherwise returns None.
Returns the symbol associated with the given string for this interner
if existent, otherwise returns None.
Returns the number of uniquely interned strings within this interner.
Returns an iterator over the interned strings.
Returns an iterator over all intern indices and their associated strings.
Shrinks the capacity of the interner as much as possible.
Trait Implementations
impl<'de, Sym, H> Deserialize<'de> for StringInterner<Sym, H> where
Sym: Symbol,
H: BuildHasher + Default, [src]
impl<'de, Sym, H> Deserialize<'de> for StringInterner<Sym, H> where
Sym: Symbol,
H: BuildHasher + Default, [src]fn deserialize<D>(deserializer: D) -> Result<StringInterner<Sym, H>, D::Error> where
D: Deserializer<'de>, [src]
fn deserialize<D>(deserializer: D) -> Result<StringInterner<Sym, H>, D::Error> where
D: Deserializer<'de>, [src]Deserialize this value from the given Serde deserializer. Read more
Extends a collection with the contents of an iterator. Read more
extend_one)Extends a collection with exactly one element.
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
impl<T, S> FromIterator<T> for StringInterner<S> where
S: Symbol,
T: Into<String> + AsRef<str>, [src]
impl<T, S> FromIterator<T> for StringInterner<S> where
S: Symbol,
T: Into<String> + AsRef<str>, [src]Creates a value from an iterator. Read more
impl<S, H> PartialEq<StringInterner<S, H>> for StringInterner<S, H> where
S: Symbol,
H: BuildHasher, [src]
impl<S, H> PartialEq<StringInterner<S, H>> for StringInterner<S, H> where
S: Symbol,
H: BuildHasher, [src]Auto Trait Implementations
impl<S, H> RefUnwindSafe for StringInterner<S, H> where
H: RefUnwindSafe,
S: RefUnwindSafe, impl<S, H> Unpin for StringInterner<S, H> where
H: Unpin,
S: Unpin, impl<S, H> UnwindSafe for StringInterner<S, H> where
H: UnwindSafe,
S: UnwindSafe, Blanket Implementations
Mutably borrows from an owned value. Read more