Trait AsImOrdMap

Source
pub trait AsImOrdMap<K: Ord + Clone, V: Clone>: Clone {
    // Required methods
    fn insert(&mut self, k: K, v: V) -> Option<V>;
    fn remove<BK: Ord>(&mut self, k: &BK) -> Option<V>
       where K: Borrow<BK>;
    fn remove_with_key<BK: Ord>(&mut self, k: &BK) -> Option<(K, V)>
       where K: Borrow<BK>;

    // Provided methods
    fn to_inserted(&self, k: K, v: V) -> (Self, Option<V>) { ... }
    fn to_removed<BK: Ord>(&mut self, k: &BK) -> (Self, Option<V>)
       where K: Borrow<BK> { ... }
    fn to_removed_with_key<BK: Ord>(&mut self, k: &BK) -> (Self, Option<(K, V)>)
       where K: Borrow<BK> { ... }
    fn to_extended<I: IntoIterator<Item = (K, V)>>(&self, iter: I) -> Self
       where Self: Extend<(K, V)> { ... }
    fn iter_clone(&self) -> Self::IntoIter
       where Self: IntoIterator { ... }
}

Required Methods§

Source

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

Source

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

Source

fn remove_with_key<BK: Ord>(&mut self, k: &BK) -> Option<(K, V)>
where K: Borrow<BK>,

Provided Methods§

Source

fn to_inserted(&self, k: K, v: V) -> (Self, Option<V>)

Source

fn to_removed<BK: Ord>(&mut self, k: &BK) -> (Self, Option<V>)
where K: Borrow<BK>,

Source

fn to_removed_with_key<BK: Ord>(&mut self, k: &BK) -> (Self, Option<(K, V)>)
where K: Borrow<BK>,

Source

fn to_extended<I: IntoIterator<Item = (K, V)>>(&self, iter: I) -> Self
where Self: Extend<(K, V)>,

Source

fn iter_clone(&self) -> Self::IntoIter
where Self: IntoIterator,

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: Ord + Clone, V: Clone> AsImOrdMap<K, V> for OrdMap<K, V>

Source§

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

Source§

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

Source§

fn remove_with_key<BK: Ord>(&mut self, k: &BK) -> Option<(K, V)>
where K: Borrow<BK>,

Source§

impl<K: Ord + Clone, V: Clone> AsImOrdMap<K, V> for OrdMap<K, V>

Source§

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

Source§

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

Source§

fn remove_with_key<BK: Ord>(&mut self, k: &BK) -> Option<(K, V)>
where K: Borrow<BK>,

Implementors§