pub enum CacheState<T> {
Actual(CachedValue<T>),
Stale(CachedValue<T>),
Miss,
}Expand description
Represents cuurent state of cached data.
Variants§
Actual(CachedValue<T>)
Cached data is exists and actual.
Stale(CachedValue<T>)
Cached data is exists and stale.
Miss
Cached data does not exists.
Implementations§
Source§impl<T, U> CacheState<T>
impl<T, U> CacheState<T>
Sourcepub fn from_bytes(bytes: Option<&Vec<u8>>) -> Result<Self, CacheError>
pub fn from_bytes(bytes: Option<&Vec<u8>>) -> Result<Self, CacheError>
Deserialize optional vector of bytes and check the actuality.
Trait Implementations§
Source§impl<T, U> From<Option<CachedValue<U>>> for CacheState<T>where
T: CacheableResponse<Cached = U>,
U: Serialize,
impl<T, U> From<Option<CachedValue<U>>> for CacheState<T>where
T: CacheableResponse<Cached = U>,
U: Serialize,
Source§fn from(cached_value: Option<CachedValue<U>>) -> Self
fn from(cached_value: Option<CachedValue<U>>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<T> Freeze for CacheState<T>where
T: Freeze,
impl<T> RefUnwindSafe for CacheState<T>where
T: RefUnwindSafe,
impl<T> Send for CacheState<T>where
T: Send,
impl<T> Sync for CacheState<T>where
T: Sync,
impl<T> Unpin for CacheState<T>where
T: Unpin,
impl<T> UnwindSafe for CacheState<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