pub struct Cache<TKey, TData, S = RandomState>{ /* private fields */ }Implementations§
Source§impl<TKey, TData, S> Cache<TKey, TData, S>
impl<TKey, TData, S> Cache<TKey, TData, S>
pub fn new(policy: CachePolicy) -> Self
pub fn get(&self, key: &TKey) -> Option<TData>
pub fn contains_key(&self, key: &TKey) -> bool
pub fn insert(&self, key: TKey, data: TData)
pub fn insert_many(&self, iter: &mut impl Iterator<Item = (TKey, TData)>)
pub fn update_if_entry_exists<F>(&self, key: TKey, op: F)where
F: Fn(&mut TData),
pub fn remove(&self, key: &TKey) -> Option<TData>
pub fn remove_many(&self, key_iter: &mut impl Iterator<Item = TKey>)
pub fn remove_all(&self)
Trait Implementations§
Auto Trait Implementations§
impl<TKey, TData, S> Freeze for Cache<TKey, TData, S>
impl<TKey, TData, S = RandomState> !RefUnwindSafe for Cache<TKey, TData, S>
impl<TKey, TData, S> Send for Cache<TKey, TData, S>
impl<TKey, TData, S> Sync for Cache<TKey, TData, S>
impl<TKey, TData, S> Unpin for Cache<TKey, TData, S>
impl<TKey, TData, S = RandomState> !UnwindSafe for Cache<TKey, TData, S>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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