pub struct ChainMap<K, V, S = RandomState> { /* private fields */ }
Implementations§
Source§impl<K, V, S> ChainMap<K, V, S>
impl<K, V, S> ChainMap<K, V, S>
pub fn new(map: HashMap<K, V, S>) -> Self
Sourcepub fn insert(&mut self, key: K, value: V) -> Option<V>
pub fn insert(&mut self, key: K, value: V) -> Option<V>
Inserts a key-value pair into the map. If the map did not have this key present, None is returned.
pub fn insert_at( &mut self, idx: usize, key: K, value: V, ) -> Result<Option<V>, Error>
Sourcepub fn get<Q>(&self, key: &Q) -> Option<&V>
pub fn get<Q>(&self, key: &Q) -> Option<&V>
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.
Sourcepub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>
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>(&self, idx: usize, key: &Q) -> Option<&V>
pub fn get_before_mut<Q>(&mut self, idx: usize, key: &Q) -> Option<&mut V>
pub fn new_child_with(&mut self, map: HashMap<K, V, S>)
pub fn last_has<Q>(&self, key: &Q) -> bool
pub fn has_at<Q>(&self, idx: usize, key: &Q) -> bool
pub fn child_len(&self) -> usize
pub fn get_last_index<Q>(&self, key: &Q) -> Option<usize>
Trait Implementations§
impl<K, V, S> Eq for ChainMap<K, V, S>
Auto Trait Implementations§
impl<K, V, S> Freeze for ChainMap<K, V, S>
impl<K, V, S> RefUnwindSafe for ChainMap<K, V, S>
impl<K, V, S> Send for ChainMap<K, V, S>
impl<K, V, S> Sync for ChainMap<K, V, S>
impl<K, V, S> Unpin for ChainMap<K, V, S>
impl<K, V, S> UnwindSafe for ChainMap<K, V, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more