[−][src]Struct hash_chain::ChainMap
Implementations
impl<K: Hash + Eq, V, S: BuildHasher> ChainMap<K, V, S> where
K: Hash + Eq,
S: BuildHasher,
[src]
K: Hash + Eq,
S: BuildHasher,
pub fn new(map: HashMap<K, V, S>) -> 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 insert_at(
&mut self,
idx: usize,
key: K,
value: V
) -> Result<Option<V>, Error>
[src]
&mut self,
idx: usize,
key: K,
value: V
) -> Result<Option<V>, Error>
pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&V> where
K: Borrow<Q>,
Q: Hash + Eq,
[src]
K: Borrow<Q>,
Q: Hash + Eq,
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]
K: Borrow<Q>,
Q: Hash + Eq,
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]
K: Borrow<Q>,
Q: Hash + Eq,
pub fn get_before_mut<Q: ?Sized>(
&mut self,
idx: usize,
key: &Q
) -> Option<&mut V> where
K: Borrow<Q>,
Q: Hash + Eq,
[src]
&mut self,
idx: usize,
key: &Q
) -> Option<&mut V> where
K: Borrow<Q>,
Q: Hash + Eq,
pub fn new_child_with(&mut self, map: HashMap<K, V, S>)
[src]
pub fn last_has<Q: ?Sized>(&self, key: &Q) -> bool where
K: Borrow<Q>,
Q: Hash + Eq,
[src]
K: Borrow<Q>,
Q: Hash + Eq,
pub fn has_at<Q: ?Sized>(&self, idx: usize, key: &Q) -> bool where
K: Borrow<Q>,
Q: Hash + Eq,
[src]
K: Borrow<Q>,
Q: Hash + Eq,
pub fn child_len(&self) -> usize
[src]
pub fn get_last_index<Q: ?Sized>(&self, key: &Q) -> Option<usize> where
K: Borrow<Q>,
Q: Hash + Eq,
[src]
K: Borrow<Q>,
Q: Hash + Eq,
impl<K: Hash + Eq, V, S: BuildHasher + Default> ChainMap<K, V, S>
[src]
pub fn new_child(&mut self)
[src]
pub fn remove_child(&mut self) -> Option<HashMap<K, V, S>>
[src]
pub fn split_off(&mut self, idx: usize) -> Self
[src]
pub fn append(&mut self, other: &mut Self)
[src]
Trait Implementations
impl<K: Clone, V: Clone, S: Clone> Clone for ChainMap<K, V, S>
[src]
impl<K, V, S> Debug for ChainMap<K, V, S> where
K: Eq + Hash + Debug,
V: Debug,
S: BuildHasher,
[src]
K: Eq + Hash + Debug,
V: Debug,
S: BuildHasher,
impl<K, V> Default for ChainMap<K, V> where
K: Hash + Eq,
[src]
K: Hash + Eq,
impl<K, V, S> Eq for ChainMap<K, V, S> where
K: Eq + Hash,
V: Eq,
S: BuildHasher,
[src]
K: Eq + Hash,
V: Eq,
S: BuildHasher,
impl<'_, K, Q: ?Sized, V, S> Index<&'_ Q> for ChainMap<K, V, S> where
K: Eq + Hash + Borrow<Q>,
Q: Eq + Hash,
S: BuildHasher,
[src]
K: Eq + Hash + Borrow<Q>,
Q: Eq + Hash,
S: BuildHasher,
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
.
impl<K, V, S> PartialEq<ChainMap<K, V, S>> for ChainMap<K, V, S> where
K: Eq + Hash,
V: PartialEq,
S: BuildHasher,
[src]
K: Eq + Hash,
V: PartialEq,
S: BuildHasher,
Auto Trait Implementations
impl<K, V, S> RefUnwindSafe for ChainMap<K, V, S> where
K: RefUnwindSafe,
S: RefUnwindSafe,
V: RefUnwindSafe,
K: RefUnwindSafe,
S: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V, S> Send for ChainMap<K, V, S> where
K: Send,
S: Send,
V: Send,
K: Send,
S: Send,
V: Send,
impl<K, V, S> Sync for ChainMap<K, V, S> where
K: Sync,
S: Sync,
V: Sync,
K: Sync,
S: Sync,
V: Sync,
impl<K, V, S> Unpin for ChainMap<K, V, S> where
K: Unpin,
S: Unpin,
V: Unpin,
K: Unpin,
S: Unpin,
V: Unpin,
impl<K, V, S> UnwindSafe for ChainMap<K, V, S> where
K: UnwindSafe,
S: UnwindSafe,
V: UnwindSafe,
K: UnwindSafe,
S: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,