Trait Container

Source
pub trait Container {
    type Key;
    type Value;
    type Entry<'a>: ContainerEntry<'a, Key = Self::Key, Value = Self::Value>
       where Self: 'a,
             Self::Key: 'a,
             Self::Value: 'a;
    type Iter<'a>: Iterator<Item = (&'a Self::Key, &'a Self::Value)>
       where Self: 'a,
             Self::Key: 'a,
             Self::Value: 'a;
    type Drain<'a>: Iterator<Item = (Self::Key, Self::Value)>
       where Self: 'a,
             Self::Key: 'a,
             Self::Value: 'a;

    // Required methods
    fn get(&self, key: &Self::Key) -> Option<&Self::Value>;
    fn get_mut(&mut self, key: &Self::Key) -> Option<&mut Self::Value>;
    fn insert(
        &mut self,
        key: Self::Key,
        value: Self::Value,
    ) -> Option<Self::Value>;
    fn remove(&mut self, key: &Self::Key) -> Option<Self::Value>;
    fn entry(&mut self, key: Self::Key) -> Self::Entry<'_>;
    fn iter(&self) -> Self::Iter<'_>;
    fn drain(&mut self) -> Self::Drain<'_>;
}

Required Associated Types§

Source

type Key

Source

type Value

Source

type Entry<'a>: ContainerEntry<'a, Key = Self::Key, Value = Self::Value> where Self: 'a, Self::Key: 'a, Self::Value: 'a

Source

type Iter<'a>: Iterator<Item = (&'a Self::Key, &'a Self::Value)> where Self: 'a, Self::Key: 'a, Self::Value: 'a

Source

type Drain<'a>: Iterator<Item = (Self::Key, Self::Value)> where Self: 'a, Self::Key: 'a, Self::Value: 'a

Required Methods§

Source

fn get(&self, key: &Self::Key) -> Option<&Self::Value>

Source

fn get_mut(&mut self, key: &Self::Key) -> Option<&mut Self::Value>

Source

fn insert(&mut self, key: Self::Key, value: Self::Value) -> Option<Self::Value>

Source

fn remove(&mut self, key: &Self::Key) -> Option<Self::Value>

Source

fn entry(&mut self, key: Self::Key) -> Self::Entry<'_>

Source

fn iter(&self) -> Self::Iter<'_>

Source

fn drain(&mut self) -> Self::Drain<'_>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<K, V> Container for BTreeMap<K, V>
where K: Ord,

Source§

type Key = K

Source§

type Value = V

Source§

type Entry<'a> = Entry<'a, K, V> where K: 'a, V: 'a

Source§

type Iter<'a> = Iter<'a, K, V> where K: 'a, V: 'a

Source§

type Drain<'a> = BTreeMapDrain<'a, K, V> where K: 'a, V: 'a

Source§

fn get(&self, key: &Self::Key) -> Option<&Self::Value>

Source§

fn get_mut(&mut self, key: &Self::Key) -> Option<&mut Self::Value>

Source§

fn insert(&mut self, key: Self::Key, value: Self::Value) -> Option<Self::Value>

Source§

fn remove(&mut self, key: &Self::Key) -> Option<Self::Value>

Source§

fn entry(&mut self, key: Self::Key) -> Self::Entry<'_>

Source§

fn iter(&self) -> Self::Iter<'_>

Source§

fn drain(&mut self) -> Self::Drain<'_>

Source§

impl<K, V> Container for HashMap<K, V>
where K: Eq + Hash,

Source§

type Key = K

Source§

type Value = V

Source§

type Entry<'a> = Entry<'a, K, V> where K: 'a, V: 'a

Source§

type Iter<'a> = Iter<'a, K, V> where K: 'a, V: 'a

Source§

type Drain<'a> = Drain<'a, K, V> where K: 'a, V: 'a

Source§

fn get(&self, key: &Self::Key) -> Option<&Self::Value>

Source§

fn get_mut(&mut self, key: &Self::Key) -> Option<&mut Self::Value>

Source§

fn insert(&mut self, key: Self::Key, value: Self::Value) -> Option<Self::Value>

Source§

fn remove(&mut self, key: &Self::Key) -> Option<Self::Value>

Source§

fn entry(&mut self, key: Self::Key) -> Self::Entry<'_>

Source§

fn iter(&self) -> Self::Iter<'_>

Source§

fn drain(&mut self) -> Self::Drain<'_>

Implementors§

Source§

impl<const FIXED: bool, K, V, F> Container for VecMap<FIXED, K, V, F>
where F: Fn(&K) -> usize,

Source§

type Key = K

Source§

type Value = V

Source§

type Entry<'a> = Entry<'a, K, V> where Self: 'a, Self::Key: 'a, Self::Value: 'a

Source§

type Iter<'a> = Map<FilterMap<Iter<'a, Option<(K, V)>>, fn(&Option<(K, V)>) -> Option<&(K, V)>>, fn(&(K, V)) -> (&K, &V)> where Self: 'a, Self::Key: 'a, Self::Value: 'a

Source§

type Drain<'a> = FilterMap<IterMut<'a, Option<(K, V)>>, fn(&mut Option<(K, V)>) -> Option<(K, V)>> where Self: 'a, Self::Key: 'a, Self::Value: 'a