Trait OccupiedEntry

Source
pub trait OccupiedEntry<'a, T: ?Sized + GetEntry<'a>> {
    // Required methods
    fn key(&self) -> &T::Key;
    fn get(&self) -> &T::Value;
    fn get_mut(&mut self) -> &mut T::Value;
    fn insert(&mut self, value: T::Value) -> T::Value;
    fn into_mut(self) -> &'a mut T::Value;
    fn remove_entry(self) -> (T::Key, T::Value);
}
Expand description

A trait for an entry with a value.

Required Methods§

Source

fn key(&self) -> &T::Key

Gets a reference to the key at this entry.

Source

fn get(&self) -> &T::Value

Gets a reference to the value at this entry.

Source

fn get_mut(&mut self) -> &mut T::Value

Gets a mutable reference to the value at this entry.

Source

fn insert(&mut self, value: T::Value) -> T::Value

Inserts the given value into this entry, returning the old value.

Source

fn into_mut(self) -> &'a mut T::Value

Consumes this entry handle, yielding a mutable reference to its value.

Source

fn remove_entry(self) -> (T::Key, T::Value)

Removes this entry, returning both its key and value.

Implementations on Foreign Types§

Source§

impl<'a, K: 'a + Ord, V: 'a> OccupiedEntry<'a, BTreeMap<K, V>> for OccupiedEntry<'a, K, V>

Source§

fn key(&self) -> &<BTreeMap<K, V> as HasMapData>::Key

Source§

fn get(&self) -> &<BTreeMap<K, V> as HasMapData>::Value

Source§

fn get_mut(&mut self) -> &mut <BTreeMap<K, V> as HasMapData>::Value

Source§

fn insert( &mut self, value: <BTreeMap<K, V> as HasMapData>::Value, ) -> <BTreeMap<K, V> as HasMapData>::Value

Source§

fn into_mut(self) -> &'a mut <BTreeMap<K, V> as HasMapData>::Value

Source§

fn remove_entry( self, ) -> (<BTreeMap<K, V> as HasMapData>::Key, <BTreeMap<K, V> as HasMapData>::Value)

Source§

impl<'a, K: 'a + Hash + Eq, V: 'a> OccupiedEntry<'a, HashMap<K, V>> for OccupiedEntry<'a, K, V>

Source§

fn key(&self) -> &<HashMap<K, V> as HasMapData>::Key

Source§

fn get(&self) -> &<HashMap<K, V> as HasMapData>::Value

Source§

fn get_mut(&mut self) -> &mut <HashMap<K, V> as HasMapData>::Value

Source§

fn insert( &mut self, value: <HashMap<K, V> as HasMapData>::Value, ) -> <HashMap<K, V> as HasMapData>::Value

Source§

fn into_mut(self) -> &'a mut <HashMap<K, V> as HasMapData>::Value

Source§

fn remove_entry( self, ) -> (<HashMap<K, V> as HasMapData>::Key, <HashMap<K, V> as HasMapData>::Value)

Implementors§