Struct fuchsia_inspect_contrib::nodes::LruCacheNode
source · pub struct LruCacheNode<T: Unit + Eq + Hash> { /* private fields */ }
Expand description
A Inspect node that holds an ordered, bounded set of data. When a new unique item needs to be inserted, the least-recently-used item is evicted.
Implementations§
source§impl<T: Unit + Eq + Hash> LruCacheNode<T>
impl<T: Unit + Eq + Hash> LruCacheNode<T>
pub fn new(node: Node, capacity: usize) -> Self
sourcepub fn insert(&mut self, item: T) -> usize
pub fn insert(&mut self, item: T) -> usize
Insert |item| into LruCacheNode
.
If |item| already exists in the cache, its entry is retrieved and the entry’s index is returned. If |item| has not already existed in the cache, the item is recorded with the current timestamp and its index in the cache is returned. If the cache is already full, recording the new item would evict the least-recently-used item.
Auto Trait Implementations§
impl<T> Freeze for LruCacheNode<T>
impl<T> !RefUnwindSafe for LruCacheNode<T>
impl<T> Send for LruCacheNode<T>
impl<T> Sync for LruCacheNode<T>
impl<T> Unpin for LruCacheNode<T>
impl<T> !UnwindSafe for LruCacheNode<T>
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