pub struct Tracker<K, V: Trackable> { /* private fields */ }Expand description
Flow tracker for types that have an intrinsic timestamp (via Trackable trait)
Implementations§
Source§impl<K, V> Tracker<K, V>
impl<K, V> Tracker<K, V>
pub fn new() -> Self
pub fn with_capacity(capacity: usize) -> Self
pub fn get_or_insert_with<F>(&mut self, key: &K, create: F) -> &mut Vwhere
F: FnOnce() -> V,
Sourcepub fn process_and_evict<F>(&mut self, process: F) -> usize
pub fn process_and_evict<F>(&mut self, process: F) -> usize
Evict entries based on a predicate function, in lru order
Sourcepub fn get_timestamp(&self, key: &K) -> Option<V::Timestamp>
pub fn get_timestamp(&self, key: &K) -> Option<V::Timestamp>
Get the timestamp of an entry
Sourcepub fn iter(&self) -> impl Iterator<Item = (&K, &V)>
pub fn iter(&self) -> impl Iterator<Item = (&K, &V)>
Iterator over entries (from oldest to newest)
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = (&K, &mut V)>
pub fn iter_mut(&mut self) -> impl Iterator<Item = (&K, &mut V)>
Mutable iterator over entries (from oldest to newest)
Sourcepub fn values_mut(&mut self) -> impl Iterator<Item = &mut V>
pub fn values_mut(&mut self) -> impl Iterator<Item = &mut V>
Mutable iterator over values (from oldest to newest)
Auto Trait Implementations§
impl<K, V> Freeze for Tracker<K, V>
impl<K, V> RefUnwindSafe for Tracker<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for Tracker<K, V>
impl<K, V> Sync for Tracker<K, V>
impl<K, V> Unpin for Tracker<K, V>
impl<K, V> UnsafeUnpin for Tracker<K, V>
impl<K, V> UnwindSafe for Tracker<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
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