Trait MapTrait

Source
pub trait MapTrait<K, V> {
    // Required methods
    fn new() -> Self;
    fn clear(&mut self);
    fn insert(&mut self, k: K, v: V) -> Option<V>;
    fn get(&self, k: &K) -> Option<&V>;
    fn get_mut(&mut self, k: &K) -> Option<&mut V>;
}

Required Methods§

Source

fn new() -> Self

Source

fn clear(&mut self)

Source

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

Source

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

Source

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

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

Source§

fn new() -> Self

Source§

fn clear(&mut self)

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn new() -> Self

Source§

fn clear(&mut self)

Source§

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

Source§

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

Source§

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

Implementors§