struct Interner<'a, V> {
    state: RandomState,
    buckets: Vec<Option<(Option<&'a [u8]>, V)>>,
    shift: u32,
}Expand description
A best effort interner that maintains a fixed number of buckets and interns keys based on their hash value
Hash collisions will result in replacement
Fields§
§state: RandomState§buckets: Vec<Option<(Option<&'a [u8]>, V)>>§shift: u32Implementations§
Source§impl<'a, V> Interner<'a, V>
 
impl<'a, V> Interner<'a, V>
Sourcefn new(capacity: usize) -> Self
 
fn new(capacity: usize) -> Self
Capacity controls the number of unique buckets allocated within the Interner
A larger capacity reduces the probability of hash collisions, and should be set based on an approximation of the upper bound of unique values
fn intern<F: FnOnce() -> Result<V, E>, E>( &mut self, new: Option<&'a [u8]>, f: F, ) -> Result<&V, E>
Auto Trait Implementations§
impl<'a, V> Freeze for Interner<'a, V>
impl<'a, V> RefUnwindSafe for Interner<'a, V>where
    V: RefUnwindSafe,
impl<'a, V> Send for Interner<'a, V>where
    V: Send,
impl<'a, V> Sync for Interner<'a, V>where
    V: Sync,
impl<'a, V> Unpin for Interner<'a, V>where
    V: Unpin,
impl<'a, V> UnwindSafe for Interner<'a, V>where
    V: 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