jam_types::vec_map

Trait MapLike

Source
pub trait MapLike<K, V> {
    // Required methods
    fn insert(&mut self, k: K, v: V) -> Option<V>;
    fn extend(&mut self, iter: impl Iterator<Item = (K, V)>);
    fn contains_key(&self, t: &K) -> bool;
    fn remove(&mut self, t: &K) -> Option<V>;
    fn get(&self, k: &K) -> Option<&V>;
    fn get_mut(&mut self, k: &K) -> Option<&mut V>;
    fn keys<'a>(&'a self) -> impl Iterator<Item = &'a K>
       where K: 'a;
}

Required Methods§

Source

fn insert(&mut self, k: K, v: V) -> Option<V>

Source

fn extend(&mut self, iter: impl Iterator<Item = (K, V)>)

Source

fn contains_key(&self, t: &K) -> bool

Source

fn remove(&mut self, t: &K) -> Option<V>

Source

fn get(&self, k: &K) -> Option<&V>

Source

fn get_mut(&mut self, k: &K) -> Option<&mut V>

Source

fn keys<'a>(&'a self) -> impl Iterator<Item = &'a K>
where K: 'a,

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: Eq + PartialEq + Ord + PartialOrd, V> MapLike<K, V> for BTreeMap<K, V>

Source§

fn insert(&mut self, k: K, v: V) -> Option<V>

Source§

fn extend(&mut self, iter: impl Iterator<Item = (K, V)>)

Source§

fn contains_key(&self, k: &K) -> bool

Source§

fn remove(&mut self, k: &K) -> Option<V>

Source§

fn get(&self, k: &K) -> Option<&V>

Source§

fn get_mut(&mut self, k: &K) -> Option<&mut V>

Source§

fn keys<'a>(&'a self) -> impl Iterator<Item = &'a K>
where K: 'a,

Source§

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

Source§

fn insert(&mut self, k: K, v: V) -> Option<V>

Source§

fn extend(&mut self, iter: impl Iterator<Item = (K, V)>)

Source§

fn contains_key(&self, k: &K) -> bool

Source§

fn remove(&mut self, k: &K) -> Option<V>

Source§

fn get(&self, k: &K) -> Option<&V>

Source§

fn get_mut(&mut self, k: &K) -> Option<&mut V>

Source§

fn keys<'a>(&'a self) -> impl Iterator<Item = &'a K>
where K: 'a,

Implementors§

Source§

impl<K: Eq + PartialEq + Ord + PartialOrd, V> MapLike<K, V> for VecMap<K, V>