pub struct Interner { /* private fields */ }Expand description
A string interner providing O(1) equality comparison via Symbol handles.
Each unique string is stored exactly once. Interning the same string twice returns the same symbol, enabling fast equality checks by comparing integers.
Implementations§
Source§impl Interner
impl Interner
Sourcepub fn intern(&mut self, s: &str) -> Symbol
pub fn intern(&mut self, s: &str) -> Symbol
Interns a string, returning its symbol.
Returns the existing symbol if the string was already interned.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Interner
impl RefUnwindSafe for Interner
impl Send for Interner
impl Sync for Interner
impl Unpin for Interner
impl UnwindSafe for Interner
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