pub struct OccupiedEntry<'a, Key: Hash + Eq, Value> { /* private fields */ }Expand description
A view into an occupied entry in a LFU cache. It is part of the Entry
enum.
Implementations§
Source§impl<'a, Key: Hash + Eq, Value> OccupiedEntry<'a, Key, Value>
impl<'a, Key: Hash + Eq, Value> OccupiedEntry<'a, Key, Value>
Sourcepub fn remove_entry(self) -> (Rc<Key>, Value)
pub fn remove_entry(self) -> (Rc<Key>, Value)
Take the ownership of the key and value from the map.
Sourcepub fn get_mut(&mut self) -> &mut Value
pub fn get_mut(&mut self) -> &mut Value
Gets a mutable reference to the value in the entry.
If you need a reference to the OccupiedEntry which may outlive the
destruction of the Entry value, see Self::into_mut.
Sourcepub fn into_mut(self) -> &'a mut Value
pub fn into_mut(self) -> &'a mut Value
Converts the OccupiedEntry into a mutable reference to the value in
the entry with a lifetime bound to the map itself.
If you need multiple references to the OccupiedEntry, see
Self::get_mut.
Sourcepub fn insert(&mut self, value: Value) -> Value
pub fn insert(&mut self, value: Value) -> Value
Sets the value of the entry, and returns the entry’s old value. Note that the semantics for this method is closer to swapping the values rather than inserting a new value into the LFU cache. As a result, this does not reset the frequency of the key.
Auto Trait Implementations§
impl<'a, Key, Value> Freeze for OccupiedEntry<'a, Key, Value>
impl<'a, Key, Value> RefUnwindSafe for OccupiedEntry<'a, Key, Value>where
Key: RefUnwindSafe,
Value: RefUnwindSafe,
impl<'a, Key, Value> !Send for OccupiedEntry<'a, Key, Value>
impl<'a, Key, Value> !Sync for OccupiedEntry<'a, Key, Value>
impl<'a, Key, Value> Unpin for OccupiedEntry<'a, Key, Value>
impl<'a, Key, Value> !UnwindSafe for OccupiedEntry<'a, Key, Value>
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