pub enum CacheResult<T> {
Hit(CacheEntry<T>),
Stale(CacheEntry<T>),
Miss,
NegativeHit,
}Expand description
Result of a cache lookup operation
Variants§
Hit(CacheEntry<T>)
Fresh cache hit
Stale(CacheEntry<T>)
Stale but usable (within stale-while-revalidate window)
Miss
Cache miss
NegativeHit
Negative cache hit (known missing/not found)
Implementations§
Source§impl<T> CacheResult<T>
impl<T> CacheResult<T>
Sourcepub fn entry(self) -> Option<CacheEntry<T>>
pub fn entry(self) -> Option<CacheEntry<T>>
Extract the full entry, consuming the result
Sourcepub fn map<U, F>(self, f: F) -> CacheResult<U>where
F: FnOnce(T) -> U,
pub fn map<U, F>(self, f: F) -> CacheResult<U>where
F: FnOnce(T) -> U,
Map the value if present
Trait Implementations§
Source§impl<T> Clone for CacheResult<T>where
T: Clone,
impl<T> Clone for CacheResult<T>where
T: Clone,
Source§fn clone(&self) -> CacheResult<T>
fn clone(&self) -> CacheResult<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> Freeze for CacheResult<T>where
T: Freeze,
impl<T> RefUnwindSafe for CacheResult<T>where
T: RefUnwindSafe,
impl<T> Send for CacheResult<T>where
T: Send,
impl<T> Sync for CacheResult<T>where
T: Sync,
impl<T> Unpin for CacheResult<T>where
T: Unpin,
impl<T> UnwindSafe for CacheResult<T>where
T: UnwindSafe,
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