pub enum CacheState {
Empty,
Loading,
Ready(CachePayload),
Refreshing(CachePayload),
}Expand description
Cache lifecycle states.
Variants§
Empty
Cache has no payload and no work in progress.
Loading
Initial fetch is underway and no payload is yet available.
Ready(CachePayload)
Fresh payload is ready for use.
Refreshing(CachePayload)
Payload is in use while a background refresh is running.
Implementations§
Source§impl CacheState
impl CacheState
Sourcepub fn payload(&self) -> Option<&CachePayload>
pub fn payload(&self) -> Option<&CachePayload>
Retrieve the current payload if available.
Sourcepub fn payload_mut(&mut self) -> Option<&mut CachePayload>
pub fn payload_mut(&mut self) -> Option<&mut CachePayload>
Mutable access to payload when state carries one.
Trait Implementations§
Source§impl Clone for CacheState
impl Clone for CacheState
Source§fn clone(&self) -> CacheState
fn clone(&self) -> CacheState
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 !Freeze for CacheState
impl RefUnwindSafe for CacheState
impl Send for CacheState
impl Sync for CacheState
impl Unpin for CacheState
impl UnwindSafe for CacheState
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