doc.rust-lang.org
pub unsafe fn get_disjoint_unchecked_mut<Q, const N: usize>(&mut self, ks: [&Q; N]) -> [Option<&mut V>; N]
Attempts to get mutable references to N values in the map at once, without validating that the values are unique.
method
std
Stable since 1.86.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn get_disjoint_mut<Q, const N: usize>(&mut self, ks: [&Q; N]) -> [Option<&mut V>; N]
Attempts to get mutable references to N values in the map at once.
method
std
Stable since 1.86.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn get<Q>(&self, k: &Q) -> Option<&V>
Returns a reference to the value corresponding to the key.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn extract_if<F>(&mut self, pred: F) -> ExtractIf<'_, K, V, F, A>
Creates an iterator which uses a closure to determine if an element (key-value pair) should be removed.
method
std
Stable since 1.88.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn entry(&mut self, key: K) -> Entry<'_, K, V, A>
Gets the given key's corresponding entry in the map for in-place manipulation.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn drain(&mut self) -> Drain<'_, K, V, A>
Clears the map, returning all key-value pairs as an iterator. Keeps the allocated memory for reuse.
method
std
Stable since 1.6.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn contains_key<Q>(&self, k: &Q) -> bool
Returns true if the map contains a value for the specified key.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn clear(&mut self)
Clears the map, removing all key-value pairs. Keeps the allocated memory for reuse.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn capacity(&self) -> usize
Returns the number of elements the map can hold without reallocating.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct HashMap<K, V, S, A>
A hash map implemented with quadratic probing and SIMD lookup.
struct
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct ExtractIf<'a, K, V, F, A>
A draining, filtering iterator over the entries of a HashMap.
struct
std
Stable since 1.88.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn or_insert_with_key<F>(self, default: F) -> &'a mut V
Ensures a value is in the entry by inserting, if empty, the result of the default function. This method allows for generating key-derived values for insertion by providing the default function a reference to the key that was moved during the .entry(key) method call.
method
std
Stable since 1.50.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn or_insert_with<F>(self, default: F) -> &'a mut V
Ensures a value is in the entry by inserting the result of the default function if empty, and returns a mutable reference to the value in the entry.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn or_insert(self, default: V) -> &'a mut V
Ensures a value is in the entry by inserting the default if empty, and returns a mutable reference to the value in the entry.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn or_default(self) -> &'a mut V
Ensures a value is in the entry by inserting the default value if empty, and returns a mutable reference to the value in the entry.
method
std
Stable since 1.28.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn key(&self) -> &K
Returns a reference to this entry's key.
method
std
Stable since 1.10.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn insert_entry(self, value: V) -> OccupiedEntry<'a, K, V, A>
Sets the value of the entry, and returns an OccupiedEntry.
method
std
Stable since 1.83.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn and_modify<F>(self, f: F) -> Self
Provides in-place mutable access to an occupied entry before any potential inserts into the map.
method
std
Stable since 1.26.0
Version 1.100.0-nightly
doc.rust-lang.org
pub enum Entry<'a, K, V, A>
A view into a single entry in a map, which may either be vacant or occupied.
enum
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Drain<'a, K, V, A>
A draining iterator over the entries of a HashMap.
struct
std
Stable since 1.6.0
Version 1.100.0-nightly