pub struct IndexCache { /* private fields */ }
Expand description
The IndexCache
allows access to the local cache entries for a remote index
This implementation does no network I/O whatsoever, but does do disk I/O
Implementations§
Source§impl IndexCache
impl IndexCache
Sourcepub fn cached_krate(
&self,
name: KrateName<'_>,
revision: Option<&str>,
lock: &FileLock,
) -> Result<Option<IndexKrate>, Error>
pub fn cached_krate( &self, name: KrateName<'_>, revision: Option<&str>, lock: &FileLock, ) -> Result<Option<IndexKrate>, Error>
Reads a crate from the local cache of the index.
You may optionally pass in the revision the cache entry is expected to have, if it does match the cache entry will be ignored and an error returned
Sourcepub fn write_to_cache(
&self,
krate: &IndexKrate,
revision: &str,
_lock: &FileLock,
) -> Result<PathBuf, Error>
pub fn write_to_cache( &self, krate: &IndexKrate, revision: &str, _lock: &FileLock, ) -> Result<PathBuf, Error>
Writes the specified crate and revision to the cache
Sourcepub fn cache_path(&self, name: KrateName<'_>) -> PathBuf
pub fn cache_path(&self, name: KrateName<'_>) -> PathBuf
Gets the path the crate’s cache file would be located at if it exists
Sourcepub fn read_cache_file(
&self,
name: KrateName<'_>,
_lock: &FileLock,
) -> Result<Option<Vec<u8>>, Error>
pub fn read_cache_file( &self, name: KrateName<'_>, _lock: &FileLock, ) -> Result<Option<Vec<u8>>, Error>
Attempts to read the cache entry for the specified crate
It is recommended to use Self::cached_krate
Auto Trait Implementations§
impl Freeze for IndexCache
impl RefUnwindSafe for IndexCache
impl Send for IndexCache
impl Sync for IndexCache
impl Unpin for IndexCache
impl UnwindSafe for IndexCache
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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