Trait key_node_list::Map[][src]

pub trait Map<K, V> {
    fn len(&self) -> usize;
fn clear(&mut self);
fn get<Q: ?Sized>(&self, k: &Q) -> Option<&V>
    where
        K: Hash + Eq + Borrow<Q>,
        Q: Hash + Eq
;
fn get_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<&mut V>
    where
        K: Hash + Eq + Borrow<Q>,
        Q: Hash + Eq
;
fn insert(&mut self, k: K, v: V)
    where
        K: Hash + Eq
;
fn remove_entry<Q: ?Sized>(&mut self, k: &Q) -> Option<(K, V)>
    where
        K: Hash + Eq + Borrow<Q>,
        Q: Hash + Eq
; fn is_empty(&self) -> bool { ... } }
Expand description

An interface to the hash map operations used by KeyNodeList.

Any data structure that implements this trait can be used as the underlying hash map for KeyNodeList.

Required methods

Returns the number of elements in the map.

This operation should compute in O(1) time.

Clears the map, removing all key-value pairs. Keeps the allocated memory for reuse.

Returns a reference to the value corresponding to the key.

The key may be any borrowed form of the map’s key type, but Hash and Eq on the borrowed form must match those for the key type.

This operation should compute in O(1) time on average.

Returns a mutable reference to the value corresponding to the key.

The key may be any borrowed form of the map’s key type, but Hash and Eq on the borrowed form must match those for the key type.

This operation should compute in O(1) time on average.

Inserts a key-value pair into the map.

If the map did not have this key present, None is returned.

If the map did have this key present, the value is updated, and the old value is returned. The key is not updated, though; this matters for types that can be == without being identical.

This operation should compute in O(1) time on average.

fn remove_entry<Q: ?Sized>(&mut self, k: &Q) -> Option<(K, V)> where
    K: Hash + Eq + Borrow<Q>,
    Q: Hash + Eq

Removes a key from the map, returning the stored key and value if the key was previously in the map.

The key may be any borrowed form of the map’s key type, but Hash and Eq on the borrowed form must match those for the key type.

This operation should compute in O(1) time on average.

Provided methods

Returns true if the map contains no elements.

This operation should compute in O(1) time.

Implementations on Foreign Types

fn remove_entry<Q: ?Sized>(&mut self, k: &Q) -> Option<(K, V)> where
    K: Hash + Eq + Borrow<Q>,
    Q: Hash + Eq

Implementors