pub struct Indices(/* private fields */);
Expand description
A list of valid indices.
Implementations§
Source§impl Indices
impl Indices
Sourcepub fn new<P: AsRef<Path>>(path: P) -> Result<Self, Error>
pub fn new<P: AsRef<Path>>(path: P) -> Result<Self, Error>
Allocates an Index
for every valid index file in the cache directory.
An index is considered valid if it is present, meaning it will scan the directory
for the .idx#
suffix and load them into memory.
§Errors
Constructing this type is quite error prone, it needs to do quite a bit of book-keeping to get its allocation right. However, if the cache is unchanged and in its proper format it will, most likely, succeed.
The primary errors have to do with I/O, in order to read every index successfully it needs
a Dat2
reference and the metadata index.
If an index is found it needs to load its entire contents and parse it, failure at this point is considered a bug.
pub fn get(&self, key: &u8) -> Option<&Index>
pub fn count(&self) -> usize
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Indices
impl<'de> Deserialize<'de> for Indices
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a> IntoIterator for &'a Indices
impl<'a> IntoIterator for &'a Indices
Source§impl IntoIterator for Indices
impl IntoIterator for Indices
Auto Trait Implementations§
impl Freeze for Indices
impl RefUnwindSafe for Indices
impl Send for Indices
impl Sync for Indices
impl Unpin for Indices
impl UnwindSafe for Indices
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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