Trait eclectic::map::Get [] [src]

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

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

A map that supports lookups using keys of type &Q.

Required Methods

fn get(&self, key: &Q) -> Option<&Self::Value>

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

Returns None if the map contains no such key.

fn get_mut(&mut self, key: &Q) -> Option<&mut Self::Value>

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

Returns None if the map contains no such key.

Provided Methods

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

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

This is equivalent to self.get(key).is_some(), but may be optimized.

Implementors