[−][src]Struct compressible_map::LocalCache
When immutable cache access is required, use this LocalCache
to store evicted values. Then
when you get mutable cache access, call into_iter
to update the cache manually.
This cache comes with a price: the values will be boxed in order to provide stable borrows. Ideally, it should be cheap to box your values, i.e. most of their data should already be on the heap.
Implementations
impl<K, V, H> LocalCache<K, V, H> where
K: Eq + Hash,
H: Default + BuildHasher,
[src]
K: Eq + Hash,
H: Default + BuildHasher,
pub fn new() -> Self
[src]
pub fn remember_cached_access(&self, key: K)
[src]
pub fn get_or_insert_with(&self, key: K, f: impl FnOnce() -> V) -> &V
[src]
pub fn into_iter(self) -> impl Iterator<Item = (K, LocalAccess<V>)>
[src]
Trait Implementations
impl<K: Default, V: Default, H: Default> Default for LocalCache<K, V, H>
[src]
pub fn default() -> LocalCache<K, V, H>
[src]
Auto Trait Implementations
impl<K, V, H> !RefUnwindSafe for LocalCache<K, V, H>
impl<K, V, H> Send for LocalCache<K, V, H> where
H: Send,
K: Send,
V: Send,
H: Send,
K: Send,
V: Send,
impl<K, V, H> !Sync for LocalCache<K, V, H>
impl<K, V, H> Unpin for LocalCache<K, V, H> where
H: Unpin,
K: Unpin,
H: Unpin,
K: Unpin,
impl<K, V, H> UnwindSafe for LocalCache<K, V, H> where
H: UnwindSafe,
K: UnwindSafe,
V: UnwindSafe,
H: UnwindSafe,
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,