Trait indexmap::map::MutableKeys [−][src]
pub trait MutableKeys { type Key; type Value; fn get_full_mut2<Q: ?Sized>(
&mut self,
key: &Q
) -> Option<(usize, &mut Self::Key, &mut Self::Value)>
where
Q: Hash + Equivalent<Self::Key>; fn retain2<F>(&mut self, keep: F)
where
F: FnMut(&mut Self::Key, &mut Self::Value) -> bool; fn __private_marker(&self) -> PrivateMarker; }
Expand description
Opt-in mutable access to keys.
These methods expose &mut K
, mutable references to the key as it is stored
in the map.
You are allowed to modify the keys in the hashmap if the modifcation
does not change the key’s hash and equality.
If keys are modified erronously, you can no longer look them up. This is sound (memory safe) but a logical error hazard (just like implementing PartialEq, Eq, or Hash incorrectly would be).
use
this trait to enable its methods for IndexMap
.
Associated Types
Loading content...Required methods
fn get_full_mut2<Q: ?Sized>(
&mut self,
key: &Q
) -> Option<(usize, &mut Self::Key, &mut Self::Value)> where
Q: Hash + Equivalent<Self::Key>,
[src]
&mut self,
key: &Q
) -> Option<(usize, &mut Self::Key, &mut Self::Value)> where
Q: Hash + Equivalent<Self::Key>,
Expand description
Return item index, mutable reference to key and value
fn retain2<F>(&mut self, keep: F) where
F: FnMut(&mut Self::Key, &mut Self::Value) -> bool,
[src]
F: FnMut(&mut Self::Key, &mut Self::Value) -> bool,
Expand description
Scan through each key-value pair in the map and keep those where the
closure keep
returns true
.
The elements are visited in order, and remaining elements keep their order.
Computes in O(n) time (average).
fn __private_marker(&self) -> PrivateMarker
[src]
Expand description
This method is not useful in itself – it is there to “seal” the trait for external implementation, so that we can add methods without causing breaking changes.
Implementors
impl<K, V, S> MutableKeys for IndexMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher,
[src]
impl<K, V, S> MutableKeys for IndexMap<K, V, S> where
K: Eq + Hash,
S: BuildHasher,
[src]Opt-in mutable access to keys.
See MutableKeys
for more information.