pub struct GlobalInterner { /* private fields */ }Expand description
Thread-safe global string interner.
Strings interned here live for the lifetime of the program. Use this for identifiers that appear frequently across many queries.
Implementations§
Source§impl GlobalInterner
impl GlobalInterner
Sourcepub fn intern(&self, s: &str) -> InternedStr
pub fn intern(&self, s: &str) -> InternedStr
Intern a string, returning an interned reference.
If the string has been interned before, returns the existing reference. Otherwise, creates a new interned entry.
Sourcepub fn lookup(&self, s: &str) -> Option<InternedStr>
pub fn lookup(&self, s: &str) -> Option<InternedStr>
Try to get an already-interned string without creating a new entry.
Sourcepub fn stats(&self) -> InternerStats
pub fn stats(&self) -> InternerStats
Get interning statistics.
Auto Trait Implementations§
impl !Freeze for GlobalInterner
impl !RefUnwindSafe for GlobalInterner
impl Send for GlobalInterner
impl Sync for GlobalInterner
impl Unpin for GlobalInterner
impl UnwindSafe for GlobalInterner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more