pub struct OccupiedEntry<'a, K, V, const CAP: usize, I: PrimInt + Unsigned> { /* private fields */ }Expand description
A view into an occupied entry in a ConstLru. It is part of the Entry enum.
Implementations§
Source§impl<'a, K, V, const CAP: usize, I: PrimInt + Unsigned> OccupiedEntry<'a, K, V, CAP, I>
impl<'a, K, V, const CAP: usize, I: PrimInt + Unsigned> OccupiedEntry<'a, K, V, CAP, I>
Sourcepub fn get(&mut self) -> &V
pub fn get(&mut self) -> &V
Gets a reference to the value in the entry and moves entry to most recently used slot
To not update to most-recently-used, use Self::get_untouched
Sourcepub fn get_untouched(&self) -> &V
pub fn get_untouched(&self) -> &V
Gets a reference to the value in the entry
Sourcepub fn get_mut(&mut self) -> &mut V
pub fn get_mut(&mut self) -> &mut V
Gets a mutable reference to the value in the entry and moves entry to most recently used slot
To not update to most-recently-used, use Self::get_mut_untouched
Sourcepub fn get_mut_untouched(&mut self) -> &mut V
pub fn get_mut_untouched(&mut self) -> &mut V
Gets a mutable reference to the value in the entry
Sourcepub fn insert(&mut self, v: V) -> V
pub fn insert(&mut self, v: V) -> V
Sets the value of the entry, and returns the entry’s old value.
Sourcepub fn into_mut(self) -> &'a mut V
pub fn into_mut(self) -> &'a mut V
Converts the OccupiedEntry into a mutable reference to the value in the entry with a lifetime bound to the ConstLru itself.
Also moves the entry to most recently used slot
To not update to most-recently-used, use Self::into_mut_untouched
Sourcepub fn into_mut_untouched(self) -> &'a mut V
pub fn into_mut_untouched(self) -> &'a mut V
Converts the OccupiedEntry into a mutable reference to the value in the entry with a lifetime bound to the ConstLru itself.
Sourcepub fn remove_entry(self) -> (K, V)
pub fn remove_entry(self) -> (K, V)
Take the ownership of the key and value from the ConstLru