pub struct Interner<T> { /* private fields */ }
Expand description
Interning data structure generic over the element type.
For the sake of simplicity and correctness we are using a rather naive implementation.
§Usage
This is used in order to quite efficiently cache strings and type definitions uniquely identified by their associated type identifiers.
Implementations§
source§impl<T> Interner<T>
impl<T> Interner<T>
sourcepub fn intern_or_get(&mut self, s: T) -> (bool, Symbol<'_, T>)
pub fn intern_or_get(&mut self, s: T) -> (bool, Symbol<'_, T>)
Interns the given element or returns its associated symbol if it has already been interned.
sourcepub fn get(&self, sym: &T) -> Option<Symbol<'_, T>>
pub fn get(&self, sym: &T) -> Option<Symbol<'_, T>>
Returns the symbol of the given element or None
if it hasn’t been
interned already.
Trait Implementations§
impl<T: Eq> Eq for Interner<T>
impl<T> StructuralPartialEq for Interner<T>
Auto Trait Implementations§
impl<T> Freeze for Interner<T>
impl<T> RefUnwindSafe for Interner<T>where
T: RefUnwindSafe,
impl<T> Send for Interner<T>where
T: Send,
impl<T> Sync for Interner<T>where
T: Sync,
impl<T> Unpin for Interner<T>where
T: Unpin,
impl<T> UnwindSafe for Interner<T>where
T: RefUnwindSafe + UnwindSafe,
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