pub struct DefaultLifecycle<Key, Val>(PhantomData<(Key, Val)>);Expand description
Default Lifecycle for the unsync cache.
Tuple Fields§
§0: PhantomData<(Key, Val)>Trait Implementations§
Source§impl<Key, Val> Clone for DefaultLifecycle<Key, Val>
impl<Key, Val> Clone for DefaultLifecycle<Key, Val>
Source§impl<Key, Val> Debug for DefaultLifecycle<Key, Val>
impl<Key, Val> Debug for DefaultLifecycle<Key, Val>
Source§impl<Key, Val> Default for DefaultLifecycle<Key, Val>
impl<Key, Val> Default for DefaultLifecycle<Key, Val>
Source§impl<Key, Val> Lifecycle<Key, Val> for DefaultLifecycle<Key, Val>
impl<Key, Val> Lifecycle<Key, Val> for DefaultLifecycle<Key, Val>
type RequestState = ()
Source§fn begin_request(&self) -> Self::RequestState
fn begin_request(&self) -> Self::RequestState
Called before the insert request starts, e.g.: insert, replace.
Source§fn on_evict(&self, _state: &mut Self::RequestState, _key: Key, _val: Val)
fn on_evict(&self, _state: &mut Self::RequestState, _key: Key, _val: Val)
Called when an item is evicted.
Source§fn is_pinned(&self, key: &Key, val: &Val) -> bool
fn is_pinned(&self, key: &Key, val: &Val) -> bool
Returns whether the item is pinned. Items that are pinned can’t be evicted.
Note that a pinned item can still be replaced with get_mut, insert, replace and similar APIs. Read more
Source§fn before_evict(&self, state: &mut Self::RequestState, key: &Key, val: &mut Val)
fn before_evict(&self, state: &mut Self::RequestState, key: &Key, val: &mut Val)
Called when a cache item is about to be evicted.
Note that value replacement (e.g. insertions for the same key) won’t call this method. Read more
Source§fn end_request(&self, state: Self::RequestState)
fn end_request(&self, state: Self::RequestState)
Called after a request finishes, e.g.: insert, replace. Read more
Auto Trait Implementations§
impl<Key, Val> Freeze for DefaultLifecycle<Key, Val>
impl<Key, Val> RefUnwindSafe for DefaultLifecycle<Key, Val>where
Key: RefUnwindSafe,
Val: RefUnwindSafe,
impl<Key, Val> Send for DefaultLifecycle<Key, Val>
impl<Key, Val> Sync for DefaultLifecycle<Key, Val>
impl<Key, Val> Unpin for DefaultLifecycle<Key, Val>
impl<Key, Val> UnwindSafe for DefaultLifecycle<Key, Val>where
Key: UnwindSafe,
Val: 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