pub struct Interner { /* private fields */ }Expand description
An append-only set of strings, each mapped to a Symbol.
Strings are never removed, which is what makes a Symbol valid for the lifetime of the
compilation and what lets the storage be a plain growing buffer.
Implementations§
Source§impl Interner
impl Interner
Sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
An interner with room for cap strings, to avoid regrowing on a large header set.
Sourcepub fn intern(&mut self, s: &str) -> Symbol
pub fn intern(&mut self, s: &str) -> Symbol
Interns s, returning the existing symbol if it has been seen.
§Panics
Panics if more than Idx::MAX distinct strings are 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 UnsafeUnpin 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