pub struct ConversionCache { /* private fields */ }Expand description
Open-addressing conversion cache with prefetch hints.
Implementations§
Source§impl ConversionCache
impl ConversionCache
Sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
Create cache with given capacity (rounded up to power of 2).
Sourcepub fn get(&mut self, term_id: u32, ctx_len: u32) -> Option<u32>
pub fn get(&mut self, term_id: u32, ctx_len: u32) -> Option<u32>
Look up a cached conversion result.
Sourcepub fn insert(&mut self, term_id: u32, ctx_len: u32, result_id: u32)
pub fn insert(&mut self, term_id: u32, ctx_len: u32, result_id: u32)
Insert a conversion result.
Sourcepub fn stats(&self) -> &CacheStats
pub fn stats(&self) -> &CacheStats
Get statistics.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConversionCache
impl RefUnwindSafe for ConversionCache
impl Send for ConversionCache
impl Sync for ConversionCache
impl Unpin for ConversionCache
impl UnsafeUnpin for ConversionCache
impl UnwindSafe for ConversionCache
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