[][src]Struct hash_chain::ChainMap

pub struct ChainMap<K, V, S = RandomState> { /* fields omitted */ }

Methods

impl<K: Hash + Eq, V> ChainMap<K, V>[src]

pub fn new(map: HashMap<K, V>) -> Self[src]

pub fn insert(&mut self, key: K, value: V) -> Option<V>[src]

Inserts a key-value pair into the map. If the map did not have this key present, None is returned.

pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&V> where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

Returns the key-value pair corresponding to the supplied key.

The supplied 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.

pub fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Option<&mut V> where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

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

The supplied 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.

pub fn get_before<Q: ?Sized>(&self, idx: usize, key: &Q) -> Option<&V> where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

pub fn get_before_mut<Q: ?Sized>(
    &mut self,
    idx: usize,
    key: &Q
) -> Option<&mut V> where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

pub fn new_child(&mut self)[src]

pub fn new_child_with(&mut self, map: HashMap<K, V>)[src]

pub fn remove_child(&mut self) -> Option<HashMap<K, V>>[src]

pub fn last_has<Q: ?Sized>(&self, key: &Q) -> bool where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

pub fn has_at<Q: ?Sized>(&self, idx: usize, key: &Q) -> bool where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

pub fn child_len(&self) -> usize[src]

Trait Implementations

impl<K: Hash + Eq, V> Default for ChainMap<K, V>[src]

impl<'_, K, Q: ?Sized, V> Index<&'_ Q> for ChainMap<K, V> where
    K: Eq + Hash + Borrow<Q>,
    Q: Eq + Hash
[src]

type Output = V

The returned type after indexing.

fn index(&self, key: &Q) -> &V[src]

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

Panics

Panics if the key is not present in the HashMap.

Auto Trait Implementations

impl<K, V, S> RefUnwindSafe for ChainMap<K, V, S> where
    K: RefUnwindSafe,
    S: RefUnwindSafe,
    V: RefUnwindSafe

impl<K, V, S> Send for ChainMap<K, V, S> where
    K: Send,
    S: Send,
    V: Send

impl<K, V, S> Sync for ChainMap<K, V, S> where
    K: Sync,
    S: Sync,
    V: Sync

impl<K, V, S> Unpin for ChainMap<K, V, S> where
    K: Unpin,
    S: Unpin,
    V: Unpin

impl<K, V, S> UnwindSafe for ChainMap<K, V, S> where
    K: UnwindSafe,
    S: UnwindSafe,
    V: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.