Function intern

Source
pub fn intern(string: impl AsRef<str>) -> InternedStr
Available on crate feature global only.
Expand description

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.

intern(string) is equivalent to GlobalInterner.intern(string), which is transitively equivalent to GlobalInterner.lock().intern(string). (See Interner::intern and LockedInterner::intern.)

ยงPanics

This method panics if the GlobalInterner has been poisoned, and it may panic if the GlobalInterner is already locked on this thread.