Trait OccupiedMapEntry

Source
pub trait OccupiedMapEntry {
    type Value;

    // Required methods
    fn get(&self) -> &Self::Value;
    fn get_mut(&mut self) -> &mut Self::Value;
    fn into_mut<'a>(self) -> &'a mut Self::Value
       where Self: 'a;
    fn replace(&mut self, value: Self::Value) -> Self::Value;
    fn remove(self) -> Self::Value;
}
Expand description

A trait for occupied map entry types.

Required Associated Types§

Source

type Value

The map’s value type.

Required Methods§

Source

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

Gets an immutable reference to the value stored by the entry.

Source

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

Gets a mutable reference to the value stored by the entry.

Source

fn into_mut<'a>(self) -> &'a mut Self::Value
where Self: 'a,

Converts the map entry into a mutable reference to the stored value with a lifetime of the map itself.

Source

fn replace(&mut self, value: Self::Value) -> Self::Value

Replaces the value stored in the entry with another value and returns the old one.

Source

fn remove(self) -> Self::Value

Removes a value from the entry.

Implementations on Foreign Types§

Source§

impl<'a, K, V> OccupiedMapEntry for OccupiedEntry<'a, K, V>
where K: Copy + Eq + Hash + Debug + 'static, V: 'a,

Available on crate features std or indexmap only.
Source§

type Value = V

Source§

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

Source§

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

Source§

fn into_mut<'b>(self) -> &'b mut Self::Value
where Self: 'b,

Source§

fn replace(&mut self, value: Self::Value) -> Self::Value

Source§

fn remove(self) -> Self::Value

Source§

impl<'a, K, V> OccupiedMapEntry for OccupiedEntry<'a, K, V>
where K: Copy + Eq + Hash + Debug + 'static, V: 'a,

Available on crate features std or indexmap only.
Source§

type Value = V

Source§

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

Source§

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

Source§

fn into_mut<'b>(self) -> &'b mut Self::Value
where Self: 'b,

Source§

fn replace(&mut self, value: Self::Value) -> Self::Value

Source§

fn remove(self) -> Self::Value

Source§

impl<'a, K: Copy + Eq + Ord + Debug + 'static, T> OccupiedMapEntry for OccupiedEntry<'a, K, T>

Available on crate feature alloc only.
Source§

type Value = T

Source§

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

Source§

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

Source§

fn into_mut<'b>(self) -> &'b mut Self::Value
where Self: 'b,

Source§

fn replace(&mut self, value: Self::Value) -> Self::Value

Source§

fn remove(self) -> Self::Value

Implementors§