Trait MutableEntryKey

trait MutableEntryKey: private::Sealed

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.

Associated Types

type Key

Required Methods

fn key_mut(self: &mut Self) -> &mut <Self as >::Key

Gets a mutable reference to the entry's key, either within the map if occupied, or else the new key that was used to find the entry.

Implementors