pub trait MutableEntryKey: Sealed {
type Key;
// Required method
fn key_mut(&mut self) -> &mut Self::Key;
}
Expand description
Opt-in mutable access to Entry
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 map if the modification
does not change the key’s hash and equality.
If keys are modified erroneously, 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 Entry
.
This trait is sealed and cannot be implemented for types outside this crate.
Required Associated Types§
Required Methods§
Implementors§
Source§impl<K, V> MutableEntryKey for Entry<'_, K, V>
impl<K, V> MutableEntryKey for Entry<'_, K, V>
Opt-in mutable access to Entry
keys.
See MutableEntryKey
for more information.
Source§impl<K, V> MutableEntryKey for IndexedEntry<'_, K, V>
impl<K, V> MutableEntryKey for IndexedEntry<'_, K, V>
Opt-in mutable access to IndexedEntry
keys.
See MutableEntryKey
for more information.
Source§impl<K, V> MutableEntryKey for OccupiedEntry<'_, K, V>
impl<K, V> MutableEntryKey for OccupiedEntry<'_, K, V>
Opt-in mutable access to OccupiedEntry
keys.
See MutableEntryKey
for more information.
Source§impl<K, V> MutableEntryKey for VacantEntry<'_, K, V>
impl<K, V> MutableEntryKey for VacantEntry<'_, K, V>
Opt-in mutable access to VacantEntry
keys.
See MutableEntryKey
for more information.