Trait protocoll::Map [] [src]

pub trait Map<K, V> where Self: Sized {
    fn fun<'a, Q: ?Sized>(&'a self) -> Box<Fn(&Q) -> Option<&'a V> + 'a> where K: Borrow<Q>, Q: Hash + Ord;
    fn inc(self, kv: (K, V)) -> Self;
    fn dec<Q: ?Sized>(self, k: &Q) -> Self where K: Borrow<Q>, Q: Hash + Ord;
    fn zero(self) -> Self;
    fn shrink(self) -> Self;
    fn update<F>(self, k: K, f: F) -> Self where F: FnOnce(Option<V>) -> V;

    fn plus<I>(self, coll: I) -> Self where I: IntoIterator<Item=(K, V)> { ... }
    fn merge<M, F>(self, other: M, f: F) -> Self where M: IntoIterator<Item=(K, V)>, F: FnMut(V, V) -> V { ... }
}

basic protocol for maps.

Required Methods

a map maps from keys to values.

adds entry kv.

removes key k.

clear.

shrink_to_fit.

like clojure's update.

Provided Methods

pours another collection into this one.

like clojure's merge-with.

Implementors