Trait eclectic::map::Map [] [src]

pub trait Map<Q: ?Sized = Self::Key>: Base {
    fn get(&self, key: &Q) -> Option<&Self::Value>;
    fn get_mut(&mut self, key: &Q) -> Option<&mut Self::Value> where Self: Mutate;
    fn remove(&mut self, key: &Q) -> Option<Self::Value> where Self: AddRemove;

    fn contains_key(&self, key: &Q) -> bool { ... }
}

A map.

A map is a set of keys, each of which is associated with a value.

The type parameter Q represents an "equivalence" type that can be used to look up values in the map. For example, given a Map<Key = String>, it is usually possible to look up items using a str. When omitted, Q defaults to Self::Key.

Required Methods

Returns a reference to the value of the key in the map that is equivalent to the given key.

Returns None if the map contains no such key.

Returns a mutable reference to the value of the key in the map that is equivalent to the given key.

Returns None if the map contains no such key.

Removes the key in the map that is equivalent to the given key and returns its value.

Returns None if the map contained no such key.

Provided Methods

Checks if the map contains a key that is equivalent to the given key.

Implementors