pub struct LazyEntriesV3 { /* private fields */ }Expand description
Lazy-loading entry store backed by an MKE3 memory-mapped file.
Implementations§
Source§impl LazyEntriesV3
impl LazyEntriesV3
Sourcepub fn from_file<P>(path: P) -> Result<LazyEntriesV3, DictError>
pub fn from_file<P>(path: P) -> Result<LazyEntriesV3, DictError>
Open an MKE3 file and memory-map it.
§Errors
Returns DictError::Format for invalid headers and
DictError::Io for I/O failures.
Sourcepub fn cached_count(&self) -> usize
pub fn cached_count(&self) -> usize
Number of entries currently held in the LRU cache.
Sourcepub fn set_cache_size(&self, size: usize)
pub fn set_cache_size(&self, size: usize)
Resize the LRU cache (minimum 1).
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Evict all cached entries.
Sourcepub fn get(&self, index: u32) -> Result<Arc<DictEntry>, DictError>
pub fn get(&self, index: u32) -> Result<Arc<DictEntry>, DictError>
Look up entry index, returning a shared Arc.
Cache check uses peek (no LRU promotion) to avoid a write lock on
every hit; the write lock is taken only on a miss.
§Errors
Returns DictError::Format when index is out of bounds or the
on-disk record is corrupt.
Sourcepub fn get_entries_at(
&self,
first_index: u32,
surface: &str,
) -> Result<Vec<Arc<DictEntry>>, DictError>
pub fn get_entries_at( &self, first_index: u32, surface: &str, ) -> Result<Vec<Arc<DictEntry>>, DictError>
Collect all consecutive entries starting at first_index that share surface.
Iterates forward from first_index until either the end of the file or
an entry whose surface differs from surface.
§Errors
Returns DictError::Format if any individual entry cannot be loaded.
Auto Trait Implementations§
impl !Freeze for LazyEntriesV3
impl RefUnwindSafe for LazyEntriesV3
impl Send for LazyEntriesV3
impl Sync for LazyEntriesV3
impl Unpin for LazyEntriesV3
impl UnsafeUnpin for LazyEntriesV3
impl UnwindSafe for LazyEntriesV3
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more