pub struct GlobalInterner;global only.Expand description
Methods from Deref<Target = Interner>§
Sourcepub fn clear(&self)
pub fn clear(&self)
Locks this Interner and removes all of the interned strings, or blocks until it is able to do so.
interner.clear() is equivalent to intenerer.lock().clear().
(See LockedInterner::clear.)
§Panics
This method panics if this Interner has been poisoned, and it may panic if this Interner is already locked on this thread.
Sourcepub fn lock(&self) -> LockedInterner<'_, S>
pub fn lock(&self) -> LockedInterner<'_, S>
Locks this Interner on the current thread until the returned LockedInterner is dropped, or blocks until it is able to do so.
While it is locked, the current thread has exclusive access to this Interner’s methods
(accessible from the LockedInterner; any methods used directly on self may panic).
This enables some additional functionality, most notably LockedInterner::iter.
If a panic occurs on the current thread while this Interner is locked, it will become poisoned.
§Panics
This method panics if this Interner has been poisoned, and it may panic if this Interner is already locked on this thread.
Sourcepub fn intern(&self, string: impl AsRef<str>) -> InternedStrwhere
S: BuildHasher,
pub fn intern(&self, string: impl AsRef<str>) -> InternedStrwhere
S: BuildHasher,
Locks this Interner, saves the given string if it is not already saved, and returns a reference to the saved allocation, or blocks until it is able to do so.
interner.intern(string) is equivalent to interner.lock().intern(string).
(See LockedInterner::intern.)
§Panics
This method panics if this Interner has been poisoned, and it may panic if this Interner is already locked on this thread.