Expand description
A thread-safe variant of the interner.
Also provides a global interner (when the global feature is enabled), which comes with a free function intern, as well as an intern method for a few string types.
Structs§
- Global
Interner global - A global
Interner, just for convenience. - Interner
- An interner will keep track of strings and ensure there is only one allocation for any given string contents.
- Into
Iter - An owning iterator over the strings that were in an
Interner. - Iter
- An iterator over the strings in a
LockedInterner. - Locked
Interner - A locked
Interner. Thisstructis created byInterner::lock; see its documentation for more details.
Traits§
- Intern
Ext global - An “extension trait” to add a the
internmethod tostr, which effectively adds it to all types that directly or transitively implementDeref<Target = str>, which includesString, references, and smart pointers tostrorString.
Functions§
- intern
global - Locks the
GlobalInterner, saves the given string if it is not already saved, and returns the saved string, or blocks until it is able to do so.
Type Aliases§
- Interned
Str - The type of strings that have been interned.