pub struct CacheItems { /* private fields */ }Expand description
Records data about the cached sources and where their artefacts are within a Cache.
When a Source is fetched, insert its Artefact into a cache to avoid repeatedly fetching
the same source definition.
When fetching a source, check the cache subdirectory to use with CacheItems::relative_path.
Implementations§
Source§impl CacheItems
impl CacheItems
Sourcepub fn get(&self, source: &Source) -> Option<&Artefact>
pub fn get(&self, source: &Source) -> Option<&Artefact>
Retrieves a cached artefact for the given source, if it exists.
Sourcepub fn contains(&self, source: &Source) -> bool
pub fn contains(&self, source: &Source) -> bool
Check whether the cache contains the given source.
Sourcepub fn insert(&mut self, artefact: Artefact)
pub fn insert(&mut self, artefact: Artefact)
Cache an artefact and return the digest of the Source which created it. Replaces any
previous value for this source.
Sourcepub fn remove(&mut self, source: &Source) -> Option<Artefact>
pub fn remove(&mut self, source: &Source) -> Option<Artefact>
Removes a cached value for the given source, returning it if it existed.
Sourcepub fn values(&self) -> impl Iterator<Item = &Artefact>
pub fn values(&self) -> impl Iterator<Item = &Artefact>
Returns an iterator over the cached values.
Sourcepub fn relative_path<S: AsRef<Source>>(&self, source: S) -> RelCacheDir
pub fn relative_path<S: AsRef<Source>>(&self, source: S) -> RelCacheDir
Get the relative path for a source within a cache directory
Trait Implementations§
Source§impl Debug for CacheItems
impl Debug for CacheItems
Source§impl Default for CacheItems
impl Default for CacheItems
Source§fn default() -> CacheItems
fn default() -> CacheItems
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for CacheItems
impl<'de> Deserialize<'de> for CacheItems
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 CacheItems
impl<'a> IntoIterator for &'a CacheItems
Source§impl IntoIterator for CacheItems
impl IntoIterator for CacheItems
Source§impl PartialEq for CacheItems
impl PartialEq for CacheItems
Source§impl Serialize for CacheItems
impl Serialize for CacheItems
impl Eq for CacheItems
impl StructuralPartialEq for CacheItems
Auto Trait Implementations§
impl Freeze for CacheItems
impl RefUnwindSafe for CacheItems
impl Send for CacheItems
impl Sync for CacheItems
impl Unpin for CacheItems
impl UnwindSafe for CacheItems
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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