diff --git a/doc/type.impl/std/collections/hash/map/struct.HashMap.js b/doc/type.impl/std/collections/hash/map/struct.HashMap.js index 79f92071814..793940f2021 100644 --- a/doc/type.impl/std/collections/hash/map/struct.HashMap.js +++ b/doc/type.impl/std/collections/hash/map/struct.HashMap.js @@ -1,9 +1,9 @@ (function() { - var type_impls = Object.fromEntries([["hydro_lang",[["
§

impl<K, V, S> Accumulate<(K, V)> for HashMap<K, V, S>
where\n K: Eq + Hash,\n S: BuildHasher + Default,

§

fn initial(capacity: Option<usize>) -> HashMap<K, V, S>

Create a new Extend of the correct type
§

fn accumulate(&mut self, _: (K, V))

Accumulate the input into an accumulator
","Accumulate<(K, V)>","hydro_lang::ir::SeenTees"],["
§

impl<K, V> Clear for HashMap<K, V>

§

fn clear(&mut self)

Remove all the elements of the collection.
","Clear","hydro_lang::ir::SeenTees"],["
source§

impl<K, V, S> Clear for HashMap<K, V, S>

source§

fn clear(&mut self)

Clears the collection without neccesarily freeing allocations.
","Clear","hydro_lang::ir::SeenTees"],["
1.0.0 · source§

impl<K, V, S> Clone for HashMap<K, V, S>
where\n K: Clone,\n V: Clone,\n S: Clone,

source§

fn clone(&self) -> HashMap<K, V, S>

Returns a copy of the value. Read more
source§

fn clone_from(&mut self, source: &HashMap<K, V, S>)

Performs copy-assignment from source. Read more
","Clone","hydro_lang::ir::SeenTees"],["
§

impl<K, V> Collection for HashMap<K, V>

§

type Item = V

Type of the items of the collection.
","Collection","hydro_lang::ir::SeenTees"],["
§

impl<K, V> CollectionMut for HashMap<K, V>

§

type ItemMut<'a> = &'a mut V\nwhere\n HashMap<K, V>: 'a

Type of mutable references to items of the collection.
§

fn upcast_item_mut<'short, 'long>(\n r: <HashMap<K, V> as CollectionMut>::ItemMut<'long>,\n) -> <HashMap<K, V> as CollectionMut>::ItemMut<'short>
where\n 'long: 'short,\n HashMap<K, V>: 'long,

Changes an item mutable reference into a shorter lived mutable reference. Read more
","CollectionMut","hydro_lang::ir::SeenTees"],["
§

impl<K, V> CollectionRef for HashMap<K, V>

§

type ItemRef<'a> = &'a V\nwhere\n HashMap<K, V>: 'a

Type of references to items of the collection.
§

fn upcast_item_ref<'short, 'long>(\n r: <HashMap<K, V> as CollectionRef>::ItemRef<'long>,\n) -> <HashMap<K, V> as CollectionRef>::ItemRef<'short>
where\n 'long: 'short,\n HashMap<K, V>: 'long,

Changes an item reference into a shorter lived reference. Read more
","CollectionRef","hydro_lang::ir::SeenTees"],["
1.0.0 · source§

impl<K, V, S> Debug for HashMap<K, V, S>
where\n K: Debug,\n V: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
","Debug","hydro_lang::ir::SeenTees"],["
1.0.0 · source§

impl<K, V, S> Default for HashMap<K, V, S>
where\n S: Default,

source§

fn default() -> HashMap<K, V, S>

Creates an empty HashMap<K, V, S>, with the Default value for the hasher.

\n
","Default","hydro_lang::ir::SeenTees"],["
source§

impl<'de, K, V, S> Deserialize<'de> for HashMap<K, V, S>
where\n K: Deserialize<'de> + Eq + Hash,\n V: Deserialize<'de>,\n S: BuildHasher + Default,

source§

fn deserialize<D>(\n deserializer: D,\n) -> Result<HashMap<K, V, S>, <D as Deserializer<'de>>::Error>
where\n D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
","Deserialize<'de>","hydro_lang::ir::SeenTees"],["
1.4.0 · source§

impl<'a, K, V, S> Extend<(&'a K, &'a V)> for HashMap<K, V, S>
where\n K: Eq + Hash + Copy,\n V: Copy,\n S: BuildHasher,

source§

fn extend<T>(&mut self, iter: T)
where\n T: IntoIterator<Item = (&'a K, &'a V)>,

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, _: (&'a K, &'a V))

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
","Extend<(&'a K, &'a V)>","hydro_lang::ir::SeenTees"],["
1.0.0 · source§

impl<K, V, S> Extend<(K, V)> for HashMap<K, V, S>
where\n K: Eq + Hash,\n S: BuildHasher,

Inserts all new key-values from the iterator and replaces values with existing\nkeys with new values returned from the iterator.

\n
source§

fn extend<T>(&mut self, iter: T)
where\n T: IntoIterator<Item = (K, V)>,

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, _: (K, V))

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
","Extend<(K, V)>","hydro_lang::ir::SeenTees"],["
1.56.0 · source§

impl<K, V, const N: usize> From<[(K, V); N]> for HashMap<K, V>
where\n K: Eq + Hash,

source§

fn from(arr: [(K, V); N]) -> HashMap<K, V>

§Examples
\n
use std::collections::HashMap;\n\nlet map1 = HashMap::from([(1, 2), (3, 4)]);\nlet map2: HashMap<_, _> = [(1, 2), (3, 4)].into();\nassert_eq!(map1, map2);
\n
","From<[(K, V); N]>","hydro_lang::ir::SeenTees"],["
1.0.0 · source§

impl<K, V, S> FromIterator<(K, V)> for HashMap<K, V, S>
where\n K: Eq + Hash,\n S: BuildHasher + Default,

source§

fn from_iter<T>(iter: T) -> HashMap<K, V, S>
where\n T: IntoIterator<Item = (K, V)>,

Creates a value from an iterator. Read more
","FromIterator<(K, V)>","hydro_lang::ir::SeenTees"],["
§

impl<'a, Q, K, V> Get<&'a Q> for HashMap<K, V>
where\n K: Hash + Eq + Borrow<Q>,\n Q: Hash + Eq + ?Sized,

§

fn get(&self, key: &'a Q) -> Option<&V>

Returns a reference to the item stored behind the given key (if any).
§

fn contains(&self, key: T) -> bool

Checks if the collection contains an item behind the given key.
","Get<&'a Q>","hydro_lang::ir::SeenTees"],["
§

impl<'a, Q, K, V> GetKeyValue<&'a Q> for HashMap<K, V>
where\n K: Hash + Eq + Borrow<Q>,\n Q: Hash + Eq + ?Sized,

§

fn get_key_value(&self, key: &'a Q) -> Option<(&K, &V)>

Returns the key-value pair matching the given key.
","GetKeyValue<&'a Q>","hydro_lang::ir::SeenTees"],["
§

impl<'a, Q, K, V> GetMut<&'a Q> for HashMap<K, V>
where\n K: Hash + Eq + Borrow<Q>,\n Q: Hash + Eq + ?Sized,

§

fn get_mut(&mut self, key: &'a Q) -> Option<&mut V>

Returns a mutable reference to the item stored behind the given key (if any).
","GetMut<&'a Q>","hydro_lang::ir::SeenTees"],["
source§

impl<K, V> HashMap<K, V>

1.0.0 · source

pub fn new() -> HashMap<K, V>

Creates an empty HashMap.

\n

The hash map is initially created with a capacity of 0, so it will not allocate until it\nis first inserted into.

\n
§Examples
\n
use std::collections::HashMap;\nlet mut map: HashMap<&str, i32> = HashMap::new();
\n
1.0.0 · source

pub fn with_capacity(capacity: usize) -> HashMap<K, V>

Creates an empty HashMap with at least the specified capacity.

\n

The hash map will be able to hold at least capacity elements without\nreallocating. This method is allowed to allocate for more elements than\ncapacity. If capacity is 0, the hash map will not allocate.

\n
§Examples
\n
use std::collections::HashMap;\nlet mut map: HashMap<&str, i32> = HashMap::with_capacity(10);
\n
",0,"hydro_lang::ir::SeenTees"],["
source§

impl<K, V, S> HashMap<K, V, S>
where\n S: BuildHasher,

source

pub fn raw_entry_mut(&mut self) -> RawEntryBuilderMut<'_, K, V, S>

🔬This is a nightly-only experimental API. (hash_raw_entry)

Creates a raw entry builder for the HashMap.

\n

Raw entries provide the lowest level of control for searching and\nmanipulating a map. They must be manually initialized with a hash and\nthen manually searched. After this, insertions into a vacant entry\nstill require an owned key to be provided.

\n

Raw entries are useful for such exotic situations as:

\n
    \n
  • Hash memoization
  • \n
  • Deferring the creation of an owned key until it is known to be required
  • \n
  • Using a search key that doesn’t work with the Borrow trait
  • \n
  • Using custom comparison logic without newtype wrappers
  • \n
\n

Because raw entries provide much more low-level control, it’s much easier\nto put the HashMap into an inconsistent state which, while memory-safe,\nwill cause the map to produce seemingly random results. Higher-level and\nmore foolproof APIs like entry should be preferred when possible.

\n

In particular, the hash used to initialize the raw entry must still be\nconsistent with the hash of the key that is ultimately stored in the entry.\nThis is because implementations of HashMap may need to recompute hashes\nwhen resizing, at which point only the keys are available.

\n

Raw entries give mutable access to the keys. This must not be used\nto modify how the key would compare or hash, as the map will not re-evaluate\nwhere the key should go, meaning the keys may become “lost” if their\nlocation does not reflect their state. For instance, if you change a key\nso that the map now contains keys which compare equal, search may start\nacting erratically, with two keys randomly masking each other. Implementations\nare free to assume this doesn’t happen (within the limits of memory-safety).

\n
source

pub fn raw_entry(&self) -> RawEntryBuilder<'_, K, V, S>

🔬This is a nightly-only experimental API. (hash_raw_entry)

Creates a raw immutable entry builder for the HashMap.

\n

Raw entries provide the lowest level of control for searching and\nmanipulating a map. They must be manually initialized with a hash and\nthen manually searched.

\n

This is useful for

\n
    \n
  • Hash memoization
  • \n
  • Using a search key that doesn’t work with the Borrow trait
  • \n
  • Using custom comparison logic without newtype wrappers
  • \n
\n

Unless you are in such a situation, higher-level and more foolproof APIs like\nget should be preferred.

\n

Immutable raw entries have very limited use; you might instead want raw_entry_mut.

\n
",0,"hydro_lang::ir::SeenTees"],["
source§

impl<K, V, S> HashMap<K, V, S>

1.7.0 (const: unstable) · source

pub fn with_hasher(hash_builder: S) -> HashMap<K, V, S>

Creates an empty HashMap which will use the given hash builder to hash\nkeys.

\n

The created map has the default initial capacity.

\n

Warning: hash_builder is normally randomly generated, and\nis designed to allow HashMaps to be resistant to attacks that\ncause many collisions and very poor performance. Setting it\nmanually using this function can expose a DoS attack vector.

\n

The hash_builder passed should implement the BuildHasher trait for\nthe HashMap to be useful, see its documentation for details.

\n
§Examples
\n
use std::collections::HashMap;\nuse std::hash::RandomState;\n\nlet s = RandomState::new();\nlet mut map = HashMap::with_hasher(s);\nmap.insert(1, 2);
\n
1.7.0 · source

pub fn with_capacity_and_hasher(capacity: usize, hasher: S) -> HashMap<K, V, S>

Creates an empty HashMap with at least the specified capacity, using\nhasher to hash the keys.

\n

The hash map will be able to hold at least capacity elements without\nreallocating. This method is allowed to allocate for more elements than\ncapacity. If capacity is 0, the hash map will not allocate.

\n

Warning: hasher is normally randomly generated, and\nis designed to allow HashMaps to be resistant to attacks that\ncause many collisions and very poor performance. Setting it\nmanually using this function can expose a DoS attack vector.

\n

The hasher passed should implement the BuildHasher trait for\nthe HashMap to be useful, see its documentation for details.

\n
§Examples
\n
use std::collections::HashMap;\nuse std::hash::RandomState;\n\nlet s = RandomState::new();\nlet mut map = HashMap::with_capacity_and_hasher(10, s);\nmap.insert(1, 2);
\n
1.0.0 · source

pub fn capacity(&self) -> usize

Returns the number of elements the map can hold without reallocating.

\n

This number is a lower bound; the HashMap<K, V> might be able to hold\nmore, but is guaranteed to be able to hold at least this many.

\n
§Examples
\n
use std::collections::HashMap;\nlet map: HashMap<i32, i32> = HashMap::with_capacity(100);\nassert!(map.capacity() >= 100);
\n
1.0.0 · source

pub fn keys(&self) -> Keys<'_, K, V>

An iterator visiting all keys in arbitrary order.\nThe iterator element type is &'a K.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet map = HashMap::from([\n    (\"a\", 1),\n    (\"b\", 2),\n    (\"c\", 3),\n]);\n\nfor key in map.keys() {\n    println!(\"{key}\");\n}
\n
§Performance
\n

In the current implementation, iterating over keys takes O(capacity) time\ninstead of O(len) because it internally visits empty buckets too.

\n
1.54.0 · source

pub fn into_keys(self) -> IntoKeys<K, V>

Creates a consuming iterator visiting all the keys in arbitrary order.\nThe map cannot be used after calling this.\nThe iterator element type is K.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet map = HashMap::from([\n    (\"a\", 1),\n    (\"b\", 2),\n    (\"c\", 3),\n]);\n\nlet mut vec: Vec<&str> = map.into_keys().collect();\n// The `IntoKeys` iterator produces keys in arbitrary order, so the\n// keys must be sorted to test them against a sorted array.\nvec.sort_unstable();\nassert_eq!(vec, [\"a\", \"b\", \"c\"]);
\n
§Performance
\n

In the current implementation, iterating over keys takes O(capacity) time\ninstead of O(len) because it internally visits empty buckets too.

\n
1.0.0 · source

pub fn values(&self) -> Values<'_, K, V>

An iterator visiting all values in arbitrary order.\nThe iterator element type is &'a V.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet map = HashMap::from([\n    (\"a\", 1),\n    (\"b\", 2),\n    (\"c\", 3),\n]);\n\nfor val in map.values() {\n    println!(\"{val}\");\n}
\n
§Performance
\n

In the current implementation, iterating over values takes O(capacity) time\ninstead of O(len) because it internally visits empty buckets too.

\n
1.10.0 · source

pub fn values_mut(&mut self) -> ValuesMut<'_, K, V>

An iterator visiting all values mutably in arbitrary order.\nThe iterator element type is &'a mut V.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map = HashMap::from([\n    (\"a\", 1),\n    (\"b\", 2),\n    (\"c\", 3),\n]);\n\nfor val in map.values_mut() {\n    *val = *val + 10;\n}\n\nfor val in map.values() {\n    println!(\"{val}\");\n}
\n
§Performance
\n

In the current implementation, iterating over values takes O(capacity) time\ninstead of O(len) because it internally visits empty buckets too.

\n
1.54.0 · source

pub fn into_values(self) -> IntoValues<K, V>

Creates a consuming iterator visiting all the values in arbitrary order.\nThe map cannot be used after calling this.\nThe iterator element type is V.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet map = HashMap::from([\n    (\"a\", 1),\n    (\"b\", 2),\n    (\"c\", 3),\n]);\n\nlet mut vec: Vec<i32> = map.into_values().collect();\n// The `IntoValues` iterator produces values in arbitrary order, so\n// the values must be sorted to test them against a sorted array.\nvec.sort_unstable();\nassert_eq!(vec, [1, 2, 3]);
\n
§Performance
\n

In the current implementation, iterating over values takes O(capacity) time\ninstead of O(len) because it internally visits empty buckets too.

\n
1.0.0 · source

pub fn iter(&self) -> Iter<'_, K, V>

An iterator visiting all key-value pairs in arbitrary order.\nThe iterator element type is (&'a K, &'a V).

\n
§Examples
\n
use std::collections::HashMap;\n\nlet map = HashMap::from([\n    (\"a\", 1),\n    (\"b\", 2),\n    (\"c\", 3),\n]);\n\nfor (key, val) in map.iter() {\n    println!(\"key: {key} val: {val}\");\n}
\n
§Performance
\n

In the current implementation, iterating over map takes O(capacity) time\ninstead of O(len) because it internally visits empty buckets too.

\n
1.0.0 · source

pub fn iter_mut(&mut self) -> IterMut<'_, K, V>

An iterator visiting all key-value pairs in arbitrary order,\nwith mutable references to the values.\nThe iterator element type is (&'a K, &'a mut V).

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map = HashMap::from([\n    (\"a\", 1),\n    (\"b\", 2),\n    (\"c\", 3),\n]);\n\n// Update all values\nfor (_, val) in map.iter_mut() {\n    *val *= 2;\n}\n\nfor (key, val) in &map {\n    println!(\"key: {key} val: {val}\");\n}
\n
§Performance
\n

In the current implementation, iterating over map takes O(capacity) time\ninstead of O(len) because it internally visits empty buckets too.

\n
1.0.0 · source

pub fn len(&self) -> usize

Returns the number of elements in the map.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut a = HashMap::new();\nassert_eq!(a.len(), 0);\na.insert(1, \"a\");\nassert_eq!(a.len(), 1);
\n
1.0.0 · source

pub fn is_empty(&self) -> bool

Returns true if the map contains no elements.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut a = HashMap::new();\nassert!(a.is_empty());\na.insert(1, \"a\");\nassert!(!a.is_empty());
\n
1.6.0 · source

pub fn drain(&mut self) -> Drain<'_, K, V>

Clears the map, returning all key-value pairs as an iterator. Keeps the\nallocated memory for reuse.

\n

If the returned iterator is dropped before being fully consumed, it\ndrops the remaining key-value pairs. The returned iterator keeps a\nmutable borrow on the map to optimize its implementation.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut a = HashMap::new();\na.insert(1, \"a\");\na.insert(2, \"b\");\n\nfor (k, v) in a.drain().take(1) {\n    assert!(k == 1 || k == 2);\n    assert!(v == \"a\" || v == \"b\");\n}\n\nassert!(a.is_empty());
\n
source

pub fn extract_if<F>(&mut self, pred: F) -> ExtractIf<'_, K, V, F>
where\n F: FnMut(&K, &mut V) -> bool,

🔬This is a nightly-only experimental API. (hash_extract_if)

Creates an iterator which uses a closure to determine if an element should be removed.

\n

If the closure returns true, the element is removed from the map and yielded.\nIf the closure returns false, or panics, the element remains in the map and will not be\nyielded.

\n

Note that extract_if lets you mutate every value in the filter closure, regardless of\nwhether you choose to keep or remove it.

\n

If the returned ExtractIf is not exhausted, e.g. because it is dropped without iterating\nor the iteration short-circuits, then the remaining elements will be retained.\nUse retain with a negated predicate if you do not need the returned iterator.

\n
§Examples
\n

Splitting a map into even and odd keys, reusing the original map:

\n\n
#![feature(hash_extract_if)]\nuse std::collections::HashMap;\n\nlet mut map: HashMap<i32, i32> = (0..8).map(|x| (x, x)).collect();\nlet extracted: HashMap<i32, i32> = map.extract_if(|k, _v| k % 2 == 0).collect();\n\nlet mut evens = extracted.keys().copied().collect::<Vec<_>>();\nlet mut odds = map.keys().copied().collect::<Vec<_>>();\nevens.sort();\nodds.sort();\n\nassert_eq!(evens, vec![0, 2, 4, 6]);\nassert_eq!(odds, vec![1, 3, 5, 7]);
\n
1.18.0 · source

pub fn retain<F>(&mut self, f: F)
where\n F: FnMut(&K, &mut V) -> bool,

Retains only the elements specified by the predicate.

\n

In other words, remove all pairs (k, v) for which f(&k, &mut v) returns false.\nThe elements are visited in unsorted (and unspecified) order.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map: HashMap<i32, i32> = (0..8).map(|x| (x, x*10)).collect();\nmap.retain(|&k, _| k % 2 == 0);\nassert_eq!(map.len(), 4);
\n
§Performance
\n

In the current implementation, this operation takes O(capacity) time\ninstead of O(len) because it internally visits empty buckets too.

\n
1.0.0 · source

pub fn clear(&mut self)

Clears the map, removing all key-value pairs. Keeps the allocated memory\nfor reuse.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut a = HashMap::new();\na.insert(1, \"a\");\na.clear();\nassert!(a.is_empty());
\n
1.9.0 · source

pub fn hasher(&self) -> &S

Returns a reference to the map’s BuildHasher.

\n
§Examples
\n
use std::collections::HashMap;\nuse std::hash::RandomState;\n\nlet hasher = RandomState::new();\nlet map: HashMap<i32, i32> = HashMap::with_hasher(hasher);\nlet hasher: &RandomState = map.hasher();
\n
",0,"hydro_lang::ir::SeenTees"],["
source§

impl<K, V, S> HashMap<K, V, S>
where\n K: Eq + Hash,\n S: BuildHasher,

1.0.0 · source

pub fn reserve(&mut self, additional: usize)

Reserves capacity for at least additional more elements to be inserted\nin the HashMap. The collection may reserve more space to speculatively\navoid frequent reallocations. After calling reserve,\ncapacity will be greater than or equal to self.len() + additional.\nDoes nothing if capacity is already sufficient.

\n
§Panics
\n

Panics if the new allocation size overflows usize.

\n
§Examples
\n
use std::collections::HashMap;\nlet mut map: HashMap<&str, i32> = HashMap::new();\nmap.reserve(10);
\n
1.57.0 · source

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>

Tries to reserve capacity for at least additional more elements to be inserted\nin the HashMap. The collection may reserve more space to speculatively\navoid frequent reallocations. After calling try_reserve,\ncapacity will be greater than or equal to self.len() + additional if\nit returns Ok(()).\nDoes nothing if capacity is already sufficient.

\n
§Errors
\n

If the capacity overflows, or the allocator reports a failure, then an error\nis returned.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map: HashMap<&str, isize> = HashMap::new();\nmap.try_reserve(10).expect(\"why is the test harness OOMing on a handful of bytes?\");
\n
1.0.0 · source

pub fn shrink_to_fit(&mut self)

Shrinks the capacity of the map as much as possible. It will drop\ndown as much as possible while maintaining the internal rules\nand possibly leaving some space in accordance with the resize policy.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map: HashMap<i32, i32> = HashMap::with_capacity(100);\nmap.insert(1, 2);\nmap.insert(3, 4);\nassert!(map.capacity() >= 100);\nmap.shrink_to_fit();\nassert!(map.capacity() >= 2);
\n
1.56.0 · source

pub fn shrink_to(&mut self, min_capacity: usize)

Shrinks the capacity of the map with a lower limit. It will drop\ndown no lower than the supplied limit while maintaining the internal rules\nand possibly leaving some space in accordance with the resize policy.

\n

If the current capacity is less than the lower limit, this is a no-op.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map: HashMap<i32, i32> = HashMap::with_capacity(100);\nmap.insert(1, 2);\nmap.insert(3, 4);\nassert!(map.capacity() >= 100);\nmap.shrink_to(10);\nassert!(map.capacity() >= 10);\nmap.shrink_to(0);\nassert!(map.capacity() >= 2);
\n
1.0.0 · source

pub fn entry(&mut self, key: K) -> Entry<'_, K, V>

Gets the given key’s corresponding entry in the map for in-place manipulation.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut letters = HashMap::new();\n\nfor ch in \"a short treatise on fungi\".chars() {\n    letters.entry(ch).and_modify(|counter| *counter += 1).or_insert(1);\n}\n\nassert_eq!(letters[&'s'], 2);\nassert_eq!(letters[&'t'], 3);\nassert_eq!(letters[&'u'], 1);\nassert_eq!(letters.get(&'y'), None);
\n
1.0.0 · source

pub fn get<Q>(&self, k: &Q) -> Option<&V>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Returns a reference to the value corresponding to the key.

\n

The key may be any borrowed form of the map’s key type, but\nHash and Eq on the borrowed form must match those for\nthe key type.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map = HashMap::new();\nmap.insert(1, \"a\");\nassert_eq!(map.get(&1), Some(&\"a\"));\nassert_eq!(map.get(&2), None);
\n
1.40.0 · source

pub fn get_key_value<Q>(&self, k: &Q) -> Option<(&K, &V)>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Returns the key-value pair corresponding to the supplied key.

\n

The supplied key may be any borrowed form of the map’s key type, but\nHash and Eq on the borrowed form must match those for\nthe key type.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map = HashMap::new();\nmap.insert(1, \"a\");\nassert_eq!(map.get_key_value(&1), Some((&1, &\"a\")));\nassert_eq!(map.get_key_value(&2), None);
\n
source

pub fn get_many_mut<Q, const N: usize>(\n &mut self,\n ks: [&Q; N],\n) -> Option<[&mut V; N]>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

🔬This is a nightly-only experimental API. (map_many_mut)

Attempts to get mutable references to N values in the map at once.

\n

Returns an array of length N with the results of each query. For soundness, at most one\nmutable reference will be returned to any value. None will be returned if any of the\nkeys are duplicates or missing.

\n
§Examples
\n
#![feature(map_many_mut)]\nuse std::collections::HashMap;\n\nlet mut libraries = HashMap::new();\nlibraries.insert(\"Bodleian Library\".to_string(), 1602);\nlibraries.insert(\"Athenæum\".to_string(), 1807);\nlibraries.insert(\"Herzogin-Anna-Amalia-Bibliothek\".to_string(), 1691);\nlibraries.insert(\"Library of Congress\".to_string(), 1800);\n\nlet got = libraries.get_many_mut([\n    \"Athenæum\",\n    \"Library of Congress\",\n]);\nassert_eq!(\n    got,\n    Some([\n        &mut 1807,\n        &mut 1800,\n    ]),\n);\n\n// Missing keys result in None\nlet got = libraries.get_many_mut([\n    \"Athenæum\",\n    \"New York Public Library\",\n]);\nassert_eq!(got, None);\n\n// Duplicate keys result in None\nlet got = libraries.get_many_mut([\n    \"Athenæum\",\n    \"Athenæum\",\n]);\nassert_eq!(got, None);
\n
source

pub unsafe fn get_many_unchecked_mut<Q, const N: usize>(\n &mut self,\n ks: [&Q; N],\n) -> Option<[&mut V; N]>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

🔬This is a nightly-only experimental API. (map_many_mut)

Attempts to get mutable references to N values in the map at once, without validating that\nthe values are unique.

\n

Returns an array of length N with the results of each query. None will be returned if\nany of the keys are missing.

\n

For a safe alternative see get_many_mut.

\n
§Safety
\n

Calling this method with overlapping keys is undefined behavior even if the resulting\nreferences are not used.

\n
§Examples
\n
#![feature(map_many_mut)]\nuse std::collections::HashMap;\n\nlet mut libraries = HashMap::new();\nlibraries.insert(\"Bodleian Library\".to_string(), 1602);\nlibraries.insert(\"Athenæum\".to_string(), 1807);\nlibraries.insert(\"Herzogin-Anna-Amalia-Bibliothek\".to_string(), 1691);\nlibraries.insert(\"Library of Congress\".to_string(), 1800);\n\nlet got = libraries.get_many_mut([\n    \"Athenæum\",\n    \"Library of Congress\",\n]);\nassert_eq!(\n    got,\n    Some([\n        &mut 1807,\n        &mut 1800,\n    ]),\n);\n\n// Missing keys result in None\nlet got = libraries.get_many_mut([\n    \"Athenæum\",\n    \"New York Public Library\",\n]);\nassert_eq!(got, None);
\n
1.0.0 · source

pub fn contains_key<Q>(&self, k: &Q) -> bool
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Returns true if the map contains a value for the specified key.

\n

The key may be any borrowed form of the map’s key type, but\nHash and Eq on the borrowed form must match those for\nthe key type.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map = HashMap::new();\nmap.insert(1, \"a\");\nassert_eq!(map.contains_key(&1), true);\nassert_eq!(map.contains_key(&2), false);
\n
1.0.0 · source

pub fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut V>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Returns a mutable reference to the value corresponding to the key.

\n

The key may be any borrowed form of the map’s key type, but\nHash and Eq on the borrowed form must match those for\nthe key type.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map = HashMap::new();\nmap.insert(1, \"a\");\nif let Some(x) = map.get_mut(&1) {\n    *x = \"b\";\n}\nassert_eq!(map[&1], \"b\");
\n
1.0.0 · source

pub fn insert(&mut self, k: K, v: V) -> Option<V>

Inserts a key-value pair into the map.

\n

If the map did not have this key present, None is returned.

\n

If the map did have this key present, the value is updated, and the old\nvalue is returned. The key is not updated, though; this matters for\ntypes that can be == without being identical. See the module-level\ndocumentation for more.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map = HashMap::new();\nassert_eq!(map.insert(37, \"a\"), None);\nassert_eq!(map.is_empty(), false);\n\nmap.insert(37, \"b\");\nassert_eq!(map.insert(37, \"c\"), Some(\"b\"));\nassert_eq!(map[&37], \"c\");
\n
source

pub fn try_insert(\n &mut self,\n key: K,\n value: V,\n) -> Result<&mut V, OccupiedError<'_, K, V>>

🔬This is a nightly-only experimental API. (map_try_insert)

Tries to insert a key-value pair into the map, and returns\na mutable reference to the value in the entry.

\n

If the map already had this key present, nothing is updated, and\nan error containing the occupied entry and the value is returned.

\n
§Examples
\n

Basic usage:

\n\n
#![feature(map_try_insert)]\n\nuse std::collections::HashMap;\n\nlet mut map = HashMap::new();\nassert_eq!(map.try_insert(37, \"a\").unwrap(), &\"a\");\n\nlet err = map.try_insert(37, \"b\").unwrap_err();\nassert_eq!(err.entry.key(), &37);\nassert_eq!(err.entry.get(), &\"a\");\nassert_eq!(err.value, \"b\");
\n
1.0.0 · source

pub fn remove<Q>(&mut self, k: &Q) -> Option<V>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Removes a key from the map, returning the value at the key if the key\nwas previously in the map.

\n

The key may be any borrowed form of the map’s key type, but\nHash and Eq on the borrowed form must match those for\nthe key type.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map = HashMap::new();\nmap.insert(1, \"a\");\nassert_eq!(map.remove(&1), Some(\"a\"));\nassert_eq!(map.remove(&1), None);
\n
1.27.0 · source

pub fn remove_entry<Q>(&mut self, k: &Q) -> Option<(K, V)>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Removes a key from the map, returning the stored key and value if the\nkey was previously in the map.

\n

The key may be any borrowed form of the map’s key type, but\nHash and Eq on the borrowed form must match those for\nthe key type.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map = HashMap::new();\nmap.insert(1, \"a\");\nassert_eq!(map.remove_entry(&1), Some((1, \"a\")));\nassert_eq!(map.remove(&1), None);
\n
",0,"hydro_lang::ir::SeenTees"],["
§

impl<K, V, S> HashMapExt for HashMap<K, V, S>
where\n S: BuildHasher + Default,

§

fn new() -> HashMap<K, V, S>

Constructs a new HashMap
§

fn with_capacity(capacity: usize) -> HashMap<K, V, S>

Constructs a new HashMap with a given initial capacity
","HashMapExt","hydro_lang::ir::SeenTees"],["
1.0.0 · source§

impl<K, Q, V, S> Index<&Q> for HashMap<K, V, S>
where\n K: Eq + Hash + Borrow<Q>,\n Q: Eq + Hash + ?Sized,\n S: BuildHasher,

source§

fn index(&self, key: &Q) -> &V

Returns a reference to the value corresponding to the supplied key.

\n
§Panics
\n

Panics if the key is not present in the HashMap.

\n
source§

type Output = V

The returned type after indexing.
","Index<&Q>","hydro_lang::ir::SeenTees"],["
source§

impl<'de, K, V, S, E> IntoDeserializer<'de, E> for HashMap<K, V, S>
where\n K: IntoDeserializer<'de, E> + Eq + Hash,\n V: IntoDeserializer<'de, E>,\n S: BuildHasher,\n E: Error,

source§

type Deserializer = MapDeserializer<'de, <HashMap<K, V, S> as IntoIterator>::IntoIter, E>

The type of the deserializer being converted into.
source§

fn into_deserializer(\n self,\n) -> <HashMap<K, V, S> as IntoDeserializer<'de, E>>::Deserializer

Convert this value into a deserializer.
","IntoDeserializer<'de, E>","hydro_lang::ir::SeenTees"],["
1.0.0 · source§

impl<K, V, S> IntoIterator for HashMap<K, V, S>

source§

fn into_iter(self) -> IntoIter<K, V>

Creates a consuming iterator, that is, one that moves each key-value\npair out of the map in arbitrary order. The map cannot be used after\ncalling this.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet map = HashMap::from([\n    (\"a\", 1),\n    (\"b\", 2),\n    (\"c\", 3),\n]);\n\n// Not possible with .iter()\nlet vec: Vec<(&str, i32)> = map.into_iter().collect();
\n
source§

type Item = (K, V)

The type of the elements being iterated over.
source§

type IntoIter = IntoIter<K, V>

Which kind of iterator are we turning this into?
","IntoIterator","hydro_lang::ir::SeenTees"],["
§

impl<K, V> Iter for HashMap<K, V>

§

type Iter<'a> = Values<'a, K, V>\nwhere\n HashMap<K, V>: 'a

Iterator type.
§

fn iter(&self) -> <HashMap<K, V> as Iter>::Iter<'_>

Create an iterator over the items of the collection.
","Iter","hydro_lang::ir::SeenTees"],["
§

impl<K, V> Keyed for HashMap<K, V>

§

type Key = K

Type of the keys indexing each item of the collection.
","Keyed","hydro_lang::ir::SeenTees"],["
§

impl<K, V> KeyedRef for HashMap<K, V>

§

type KeyRef<'a> = &'a K\nwhere\n HashMap<K, V>: 'a

Type of references to keys of the collection.
§

fn upcast_key_ref<'short, 'long>(\n r: <HashMap<K, V> as KeyedRef>::KeyRef<'long>,\n) -> <HashMap<K, V> as KeyedRef>::KeyRef<'short>
where\n 'long: 'short,\n HashMap<K, V>: 'long,

Changes a key reference into a shorter lived reference. Read more
","KeyedRef","hydro_lang::ir::SeenTees"],["
§

impl<K, V> Len for HashMap<K, V>

§

fn len(&self) -> usize

Returns the number of elements in the collection.
§

fn is_empty(&self) -> bool

Checks if the collection is empty.
","Len","hydro_lang::ir::SeenTees"],["
§

impl<K, V> MapInsert<K> for HashMap<K, V>
where\n K: Hash + Eq,

§

type Output = Option<V>

The output of the insertion function.
§

fn insert(&mut self, key: K, value: V) -> Option<V>

Insert a new key-value pair in the collection.
","MapInsert","hydro_lang::ir::SeenTees"],["
§

impl<K, V> MapIter for HashMap<K, V>

§

type Iter<'a> = Iter<'a, K, V>\nwhere\n HashMap<K, V>: 'a

§

fn iter(&self) -> <HashMap<K, V> as MapIter>::Iter<'_>

","MapIter","hydro_lang::ir::SeenTees"],["
§

impl<K, V> MapIterMut for HashMap<K, V>

§

type IterMut<'a> = IterMut<'a, K, V>\nwhere\n HashMap<K, V>: 'a

§

fn iter_mut(&mut self) -> <HashMap<K, V> as MapIterMut>::IterMut<'_>

","MapIterMut","hydro_lang::ir::SeenTees"],["
source§

impl<Key, OldVal> MapMapValues<OldVal> for HashMap<Key, OldVal>
where\n Key: Eq + Hash,

source§

type MapValue<NewVal> = HashMap<Key, NewVal>

Output type, should be Self but with OldVal replaced with NewVal.
source§

fn map_values<NewVal, MapFn>(\n self,\n map_fn: MapFn,\n) -> <HashMap<Key, OldVal> as MapMapValues<OldVal>>::MapValue<NewVal>
where\n MapFn: FnMut(OldVal) -> NewVal,

Map the values into using the map_fn.
","MapMapValues","hydro_lang::ir::SeenTees"],["
1.0.0 · source§

impl<K, V, S> PartialEq for HashMap<K, V, S>
where\n K: Eq + Hash,\n V: PartialEq,\n S: BuildHasher,

source§

fn eq(&self, other: &HashMap<K, V, S>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient,\nand should not be overridden without very good reason.
","PartialEq","hydro_lang::ir::SeenTees"],["
§

impl<'a, Q, K, V> Remove<&'a Q> for HashMap<K, V>
where\n K: Hash + Eq + Borrow<Q>,\n Q: Hash + Eq + ?Sized,

§

fn remove(&mut self, key: &'a Q) -> Option<V>

Remove the element identified by the given key.
","Remove<&'a Q>","hydro_lang::ir::SeenTees"],["
source§

impl<K, V, H> Serialize for HashMap<K, V, H>
where\n K: Serialize,\n V: Serialize,

source§

fn serialize<S>(\n &self,\n serializer: S,\n) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where\n S: Serializer,

Serialize this value into the given Serde serializer. Read more
","Serialize","hydro_lang::ir::SeenTees"],["
§

impl<K, V> SimpleCollectionMut for HashMap<K, V>

§

fn into_mut<'r>(\n r: <HashMap<K, V> as CollectionMut>::ItemMut<'r>,\n) -> &'r mut <HashMap<K, V> as Collection>::Item
where\n HashMap<K, V>: 'r,

","SimpleCollectionMut","hydro_lang::ir::SeenTees"],["
§

impl<K, V> SimpleCollectionRef for HashMap<K, V>

§

fn into_ref<'r>(\n r: <HashMap<K, V> as CollectionRef>::ItemRef<'r>,\n) -> &'r <HashMap<K, V> as Collection>::Item
where\n HashMap<K, V>: 'r,

","SimpleCollectionRef","hydro_lang::ir::SeenTees"],["
§

impl<K, V> SimpleKeyedRef for HashMap<K, V>

§

fn into_ref<'r>(\n r: <HashMap<K, V> as KeyedRef>::KeyRef<'r>,\n) -> &'r <HashMap<K, V> as Keyed>::Key
where\n HashMap<K, V>: 'r,

","SimpleKeyedRef","hydro_lang::ir::SeenTees"],["
1.0.0 · source§

impl<K, V, S> Eq for HashMap<K, V, S>
where\n K: Eq + Hash,\n V: Eq,\n S: BuildHasher,

","Eq","hydro_lang::ir::SeenTees"],["
1.36.0 · source§

impl<K, V, S> UnwindSafe for HashMap<K, V, S>
where\n K: UnwindSafe,\n V: UnwindSafe,\n S: UnwindSafe,

","UnwindSafe","hydro_lang::ir::SeenTees"]]]]); + var type_impls = Object.fromEntries([["hydro_lang",[["
§

impl<K, V, S> Accumulate<(K, V)> for HashMap<K, V, S>
where\n K: Eq + Hash,\n S: BuildHasher + Default,

§

fn initial(capacity: Option<usize>) -> HashMap<K, V, S>

Create a new Extend of the correct type
§

fn accumulate(&mut self, _: (K, V))

Accumulate the input into an accumulator
","Accumulate<(K, V)>","hydro_lang::ir::SeenTees"],["
§

impl<K, V> Clear for HashMap<K, V>

§

fn clear(&mut self)

Remove all the elements of the collection.
","Clear","hydro_lang::ir::SeenTees"],["
source§

impl<K, V, S> Clear for HashMap<K, V, S>

source§

fn clear(&mut self)

Clears the collection without neccesarily freeing allocations.
","Clear","hydro_lang::ir::SeenTees"],["
1.0.0 · source§

impl<K, V, S> Clone for HashMap<K, V, S>
where\n K: Clone,\n V: Clone,\n S: Clone,

source§

fn clone(&self) -> HashMap<K, V, S>

Returns a copy of the value. Read more
source§

fn clone_from(&mut self, source: &HashMap<K, V, S>)

Performs copy-assignment from source. Read more
","Clone","hydro_lang::ir::SeenTees"],["
§

impl<K, V> Collection for HashMap<K, V>

§

type Item = V

Type of the items of the collection.
","Collection","hydro_lang::ir::SeenTees"],["
§

impl<K, V> CollectionMut for HashMap<K, V>

§

type ItemMut<'a> = &'a mut V\nwhere\n HashMap<K, V>: 'a

Type of mutable references to items of the collection.
§

fn upcast_item_mut<'short, 'long>(\n r: <HashMap<K, V> as CollectionMut>::ItemMut<'long>,\n) -> <HashMap<K, V> as CollectionMut>::ItemMut<'short>
where\n 'long: 'short,\n HashMap<K, V>: 'long,

Changes an item mutable reference into a shorter lived mutable reference. Read more
","CollectionMut","hydro_lang::ir::SeenTees"],["
§

impl<K, V> CollectionRef for HashMap<K, V>

§

type ItemRef<'a> = &'a V\nwhere\n HashMap<K, V>: 'a

Type of references to items of the collection.
§

fn upcast_item_ref<'short, 'long>(\n r: <HashMap<K, V> as CollectionRef>::ItemRef<'long>,\n) -> <HashMap<K, V> as CollectionRef>::ItemRef<'short>
where\n 'long: 'short,\n HashMap<K, V>: 'long,

Changes an item reference into a shorter lived reference. Read more
","CollectionRef","hydro_lang::ir::SeenTees"],["
1.0.0 · source§

impl<K, V, S> Debug for HashMap<K, V, S>
where\n K: Debug,\n V: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
","Debug","hydro_lang::ir::SeenTees"],["
1.0.0 · source§

impl<K, V, S> Default for HashMap<K, V, S>
where\n S: Default,

source§

fn default() -> HashMap<K, V, S>

Creates an empty HashMap<K, V, S>, with the Default value for the hasher.

\n
","Default","hydro_lang::ir::SeenTees"],["
source§

impl<'de, K, V, S> Deserialize<'de> for HashMap<K, V, S>
where\n K: Deserialize<'de> + Eq + Hash,\n V: Deserialize<'de>,\n S: BuildHasher + Default,

source§

fn deserialize<D>(\n deserializer: D,\n) -> Result<HashMap<K, V, S>, <D as Deserializer<'de>>::Error>
where\n D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
","Deserialize<'de>","hydro_lang::ir::SeenTees"],["
1.4.0 · source§

impl<'a, K, V, S> Extend<(&'a K, &'a V)> for HashMap<K, V, S>
where\n K: Eq + Hash + Copy,\n V: Copy,\n S: BuildHasher,

source§

fn extend<T>(&mut self, iter: T)
where\n T: IntoIterator<Item = (&'a K, &'a V)>,

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, _: (&'a K, &'a V))

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
","Extend<(&'a K, &'a V)>","hydro_lang::ir::SeenTees"],["
1.0.0 · source§

impl<K, V, S> Extend<(K, V)> for HashMap<K, V, S>
where\n K: Eq + Hash,\n S: BuildHasher,

Inserts all new key-values from the iterator and replaces values with existing\nkeys with new values returned from the iterator.

\n
source§

fn extend<T>(&mut self, iter: T)
where\n T: IntoIterator<Item = (K, V)>,

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, _: (K, V))

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
","Extend<(K, V)>","hydro_lang::ir::SeenTees"],["
1.56.0 · source§

impl<K, V, const N: usize> From<[(K, V); N]> for HashMap<K, V>
where\n K: Eq + Hash,

source§

fn from(arr: [(K, V); N]) -> HashMap<K, V>

§Examples
\n
use std::collections::HashMap;\n\nlet map1 = HashMap::from([(1, 2), (3, 4)]);\nlet map2: HashMap<_, _> = [(1, 2), (3, 4)].into();\nassert_eq!(map1, map2);
\n
","From<[(K, V); N]>","hydro_lang::ir::SeenTees"],["
1.0.0 · source§

impl<K, V, S> FromIterator<(K, V)> for HashMap<K, V, S>
where\n K: Eq + Hash,\n S: BuildHasher + Default,

source§

fn from_iter<T>(iter: T) -> HashMap<K, V, S>
where\n T: IntoIterator<Item = (K, V)>,

Creates a value from an iterator. Read more
","FromIterator<(K, V)>","hydro_lang::ir::SeenTees"],["
§

impl<'a, Q, K, V> Get<&'a Q> for HashMap<K, V>
where\n K: Hash + Eq + Borrow<Q>,\n Q: Hash + Eq + ?Sized,

§

fn get(&self, key: &'a Q) -> Option<&V>

Returns a reference to the item stored behind the given key (if any).
§

fn contains(&self, key: T) -> bool

Checks if the collection contains an item behind the given key.
","Get<&'a Q>","hydro_lang::ir::SeenTees"],["
§

impl<'a, Q, K, V> GetKeyValue<&'a Q> for HashMap<K, V>
where\n K: Hash + Eq + Borrow<Q>,\n Q: Hash + Eq + ?Sized,

§

fn get_key_value(&self, key: &'a Q) -> Option<(&K, &V)>

Returns the key-value pair matching the given key.
","GetKeyValue<&'a Q>","hydro_lang::ir::SeenTees"],["
§

impl<'a, Q, K, V> GetMut<&'a Q> for HashMap<K, V>
where\n K: Hash + Eq + Borrow<Q>,\n Q: Hash + Eq + ?Sized,

§

fn get_mut(&mut self, key: &'a Q) -> Option<&mut V>

Returns a mutable reference to the item stored behind the given key (if any).
","GetMut<&'a Q>","hydro_lang::ir::SeenTees"],["
source§

impl<K, V> HashMap<K, V>

1.0.0 · source

pub fn new() -> HashMap<K, V>

Creates an empty HashMap.

\n

The hash map is initially created with a capacity of 0, so it will not allocate until it\nis first inserted into.

\n
§Examples
\n
use std::collections::HashMap;\nlet mut map: HashMap<&str, i32> = HashMap::new();
\n
1.0.0 · source

pub fn with_capacity(capacity: usize) -> HashMap<K, V>

Creates an empty HashMap with at least the specified capacity.

\n

The hash map will be able to hold at least capacity elements without\nreallocating. This method is allowed to allocate for more elements than\ncapacity. If capacity is 0, the hash map will not allocate.

\n
§Examples
\n
use std::collections::HashMap;\nlet mut map: HashMap<&str, i32> = HashMap::with_capacity(10);
\n
",0,"hydro_lang::ir::SeenTees"],["
source§

impl<K, V, S> HashMap<K, V, S>
where\n S: BuildHasher,

source

pub fn raw_entry_mut(&mut self) -> RawEntryBuilderMut<'_, K, V, S>

🔬This is a nightly-only experimental API. (hash_raw_entry)

Creates a raw entry builder for the HashMap.

\n

Raw entries provide the lowest level of control for searching and\nmanipulating a map. They must be manually initialized with a hash and\nthen manually searched. After this, insertions into a vacant entry\nstill require an owned key to be provided.

\n

Raw entries are useful for such exotic situations as:

\n
    \n
  • Hash memoization
  • \n
  • Deferring the creation of an owned key until it is known to be required
  • \n
  • Using a search key that doesn’t work with the Borrow trait
  • \n
  • Using custom comparison logic without newtype wrappers
  • \n
\n

Because raw entries provide much more low-level control, it’s much easier\nto put the HashMap into an inconsistent state which, while memory-safe,\nwill cause the map to produce seemingly random results. Higher-level and\nmore foolproof APIs like entry should be preferred when possible.

\n

In particular, the hash used to initialize the raw entry must still be\nconsistent with the hash of the key that is ultimately stored in the entry.\nThis is because implementations of HashMap may need to recompute hashes\nwhen resizing, at which point only the keys are available.

\n

Raw entries give mutable access to the keys. This must not be used\nto modify how the key would compare or hash, as the map will not re-evaluate\nwhere the key should go, meaning the keys may become “lost” if their\nlocation does not reflect their state. For instance, if you change a key\nso that the map now contains keys which compare equal, search may start\nacting erratically, with two keys randomly masking each other. Implementations\nare free to assume this doesn’t happen (within the limits of memory-safety).

\n
source

pub fn raw_entry(&self) -> RawEntryBuilder<'_, K, V, S>

🔬This is a nightly-only experimental API. (hash_raw_entry)

Creates a raw immutable entry builder for the HashMap.

\n

Raw entries provide the lowest level of control for searching and\nmanipulating a map. They must be manually initialized with a hash and\nthen manually searched.

\n

This is useful for

\n
    \n
  • Hash memoization
  • \n
  • Using a search key that doesn’t work with the Borrow trait
  • \n
  • Using custom comparison logic without newtype wrappers
  • \n
\n

Unless you are in such a situation, higher-level and more foolproof APIs like\nget should be preferred.

\n

Immutable raw entries have very limited use; you might instead want raw_entry_mut.

\n
",0,"hydro_lang::ir::SeenTees"],["
source§

impl<K, V, S> HashMap<K, V, S>

1.7.0 (const: unstable) · source

pub fn with_hasher(hash_builder: S) -> HashMap<K, V, S>

Creates an empty HashMap which will use the given hash builder to hash\nkeys.

\n

The created map has the default initial capacity.

\n

Warning: hash_builder is normally randomly generated, and\nis designed to allow HashMaps to be resistant to attacks that\ncause many collisions and very poor performance. Setting it\nmanually using this function can expose a DoS attack vector.

\n

The hash_builder passed should implement the BuildHasher trait for\nthe HashMap to be useful, see its documentation for details.

\n
§Examples
\n
use std::collections::HashMap;\nuse std::hash::RandomState;\n\nlet s = RandomState::new();\nlet mut map = HashMap::with_hasher(s);\nmap.insert(1, 2);
\n
1.7.0 · source

pub fn with_capacity_and_hasher(capacity: usize, hasher: S) -> HashMap<K, V, S>

Creates an empty HashMap with at least the specified capacity, using\nhasher to hash the keys.

\n

The hash map will be able to hold at least capacity elements without\nreallocating. This method is allowed to allocate for more elements than\ncapacity. If capacity is 0, the hash map will not allocate.

\n

Warning: hasher is normally randomly generated, and\nis designed to allow HashMaps to be resistant to attacks that\ncause many collisions and very poor performance. Setting it\nmanually using this function can expose a DoS attack vector.

\n

The hasher passed should implement the BuildHasher trait for\nthe HashMap to be useful, see its documentation for details.

\n
§Examples
\n
use std::collections::HashMap;\nuse std::hash::RandomState;\n\nlet s = RandomState::new();\nlet mut map = HashMap::with_capacity_and_hasher(10, s);\nmap.insert(1, 2);
\n
1.0.0 · source

pub fn capacity(&self) -> usize

Returns the number of elements the map can hold without reallocating.

\n

This number is a lower bound; the HashMap<K, V> might be able to hold\nmore, but is guaranteed to be able to hold at least this many.

\n
§Examples
\n
use std::collections::HashMap;\nlet map: HashMap<i32, i32> = HashMap::with_capacity(100);\nassert!(map.capacity() >= 100);
\n
1.0.0 · source

pub fn keys(&self) -> Keys<'_, K, V>

An iterator visiting all keys in arbitrary order.\nThe iterator element type is &'a K.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet map = HashMap::from([\n    (\"a\", 1),\n    (\"b\", 2),\n    (\"c\", 3),\n]);\n\nfor key in map.keys() {\n    println!(\"{key}\");\n}
\n
§Performance
\n

In the current implementation, iterating over keys takes O(capacity) time\ninstead of O(len) because it internally visits empty buckets too.

\n
1.54.0 · source

pub fn into_keys(self) -> IntoKeys<K, V>

Creates a consuming iterator visiting all the keys in arbitrary order.\nThe map cannot be used after calling this.\nThe iterator element type is K.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet map = HashMap::from([\n    (\"a\", 1),\n    (\"b\", 2),\n    (\"c\", 3),\n]);\n\nlet mut vec: Vec<&str> = map.into_keys().collect();\n// The `IntoKeys` iterator produces keys in arbitrary order, so the\n// keys must be sorted to test them against a sorted array.\nvec.sort_unstable();\nassert_eq!(vec, [\"a\", \"b\", \"c\"]);
\n
§Performance
\n

In the current implementation, iterating over keys takes O(capacity) time\ninstead of O(len) because it internally visits empty buckets too.

\n
1.0.0 · source

pub fn values(&self) -> Values<'_, K, V>

An iterator visiting all values in arbitrary order.\nThe iterator element type is &'a V.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet map = HashMap::from([\n    (\"a\", 1),\n    (\"b\", 2),\n    (\"c\", 3),\n]);\n\nfor val in map.values() {\n    println!(\"{val}\");\n}
\n
§Performance
\n

In the current implementation, iterating over values takes O(capacity) time\ninstead of O(len) because it internally visits empty buckets too.

\n
1.10.0 · source

pub fn values_mut(&mut self) -> ValuesMut<'_, K, V>

An iterator visiting all values mutably in arbitrary order.\nThe iterator element type is &'a mut V.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map = HashMap::from([\n    (\"a\", 1),\n    (\"b\", 2),\n    (\"c\", 3),\n]);\n\nfor val in map.values_mut() {\n    *val = *val + 10;\n}\n\nfor val in map.values() {\n    println!(\"{val}\");\n}
\n
§Performance
\n

In the current implementation, iterating over values takes O(capacity) time\ninstead of O(len) because it internally visits empty buckets too.

\n
1.54.0 · source

pub fn into_values(self) -> IntoValues<K, V>

Creates a consuming iterator visiting all the values in arbitrary order.\nThe map cannot be used after calling this.\nThe iterator element type is V.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet map = HashMap::from([\n    (\"a\", 1),\n    (\"b\", 2),\n    (\"c\", 3),\n]);\n\nlet mut vec: Vec<i32> = map.into_values().collect();\n// The `IntoValues` iterator produces values in arbitrary order, so\n// the values must be sorted to test them against a sorted array.\nvec.sort_unstable();\nassert_eq!(vec, [1, 2, 3]);
\n
§Performance
\n

In the current implementation, iterating over values takes O(capacity) time\ninstead of O(len) because it internally visits empty buckets too.

\n
1.0.0 · source

pub fn iter(&self) -> Iter<'_, K, V>

An iterator visiting all key-value pairs in arbitrary order.\nThe iterator element type is (&'a K, &'a V).

\n
§Examples
\n
use std::collections::HashMap;\n\nlet map = HashMap::from([\n    (\"a\", 1),\n    (\"b\", 2),\n    (\"c\", 3),\n]);\n\nfor (key, val) in map.iter() {\n    println!(\"key: {key} val: {val}\");\n}
\n
§Performance
\n

In the current implementation, iterating over map takes O(capacity) time\ninstead of O(len) because it internally visits empty buckets too.

\n
1.0.0 · source

pub fn iter_mut(&mut self) -> IterMut<'_, K, V>

An iterator visiting all key-value pairs in arbitrary order,\nwith mutable references to the values.\nThe iterator element type is (&'a K, &'a mut V).

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map = HashMap::from([\n    (\"a\", 1),\n    (\"b\", 2),\n    (\"c\", 3),\n]);\n\n// Update all values\nfor (_, val) in map.iter_mut() {\n    *val *= 2;\n}\n\nfor (key, val) in &map {\n    println!(\"key: {key} val: {val}\");\n}
\n
§Performance
\n

In the current implementation, iterating over map takes O(capacity) time\ninstead of O(len) because it internally visits empty buckets too.

\n
1.0.0 · source

pub fn len(&self) -> usize

Returns the number of elements in the map.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut a = HashMap::new();\nassert_eq!(a.len(), 0);\na.insert(1, \"a\");\nassert_eq!(a.len(), 1);
\n
1.0.0 · source

pub fn is_empty(&self) -> bool

Returns true if the map contains no elements.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut a = HashMap::new();\nassert!(a.is_empty());\na.insert(1, \"a\");\nassert!(!a.is_empty());
\n
1.6.0 · source

pub fn drain(&mut self) -> Drain<'_, K, V>

Clears the map, returning all key-value pairs as an iterator. Keeps the\nallocated memory for reuse.

\n

If the returned iterator is dropped before being fully consumed, it\ndrops the remaining key-value pairs. The returned iterator keeps a\nmutable borrow on the map to optimize its implementation.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut a = HashMap::new();\na.insert(1, \"a\");\na.insert(2, \"b\");\n\nfor (k, v) in a.drain().take(1) {\n    assert!(k == 1 || k == 2);\n    assert!(v == \"a\" || v == \"b\");\n}\n\nassert!(a.is_empty());
\n
source

pub fn extract_if<F>(&mut self, pred: F) -> ExtractIf<'_, K, V, F>
where\n F: FnMut(&K, &mut V) -> bool,

🔬This is a nightly-only experimental API. (hash_extract_if)

Creates an iterator which uses a closure to determine if an element should be removed.

\n

If the closure returns true, the element is removed from the map and yielded.\nIf the closure returns false, or panics, the element remains in the map and will not be\nyielded.

\n

Note that extract_if lets you mutate every value in the filter closure, regardless of\nwhether you choose to keep or remove it.

\n

If the returned ExtractIf is not exhausted, e.g. because it is dropped without iterating\nor the iteration short-circuits, then the remaining elements will be retained.\nUse retain with a negated predicate if you do not need the returned iterator.

\n
§Examples
\n

Splitting a map into even and odd keys, reusing the original map:

\n\n
#![feature(hash_extract_if)]\nuse std::collections::HashMap;\n\nlet mut map: HashMap<i32, i32> = (0..8).map(|x| (x, x)).collect();\nlet extracted: HashMap<i32, i32> = map.extract_if(|k, _v| k % 2 == 0).collect();\n\nlet mut evens = extracted.keys().copied().collect::<Vec<_>>();\nlet mut odds = map.keys().copied().collect::<Vec<_>>();\nevens.sort();\nodds.sort();\n\nassert_eq!(evens, vec![0, 2, 4, 6]);\nassert_eq!(odds, vec![1, 3, 5, 7]);
\n
1.18.0 · source

pub fn retain<F>(&mut self, f: F)
where\n F: FnMut(&K, &mut V) -> bool,

Retains only the elements specified by the predicate.

\n

In other words, remove all pairs (k, v) for which f(&k, &mut v) returns false.\nThe elements are visited in unsorted (and unspecified) order.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map: HashMap<i32, i32> = (0..8).map(|x| (x, x*10)).collect();\nmap.retain(|&k, _| k % 2 == 0);\nassert_eq!(map.len(), 4);
\n
§Performance
\n

In the current implementation, this operation takes O(capacity) time\ninstead of O(len) because it internally visits empty buckets too.

\n
1.0.0 · source

pub fn clear(&mut self)

Clears the map, removing all key-value pairs. Keeps the allocated memory\nfor reuse.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut a = HashMap::new();\na.insert(1, \"a\");\na.clear();\nassert!(a.is_empty());
\n
1.9.0 · source

pub fn hasher(&self) -> &S

Returns a reference to the map’s BuildHasher.

\n
§Examples
\n
use std::collections::HashMap;\nuse std::hash::RandomState;\n\nlet hasher = RandomState::new();\nlet map: HashMap<i32, i32> = HashMap::with_hasher(hasher);\nlet hasher: &RandomState = map.hasher();
\n
",0,"hydro_lang::ir::SeenTees"],["
source§

impl<K, V, S> HashMap<K, V, S>
where\n K: Eq + Hash,\n S: BuildHasher,

1.0.0 · source

pub fn reserve(&mut self, additional: usize)

Reserves capacity for at least additional more elements to be inserted\nin the HashMap. The collection may reserve more space to speculatively\navoid frequent reallocations. After calling reserve,\ncapacity will be greater than or equal to self.len() + additional.\nDoes nothing if capacity is already sufficient.

\n
§Panics
\n

Panics if the new allocation size overflows usize.

\n
§Examples
\n
use std::collections::HashMap;\nlet mut map: HashMap<&str, i32> = HashMap::new();\nmap.reserve(10);
\n
1.57.0 · source

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>

Tries to reserve capacity for at least additional more elements to be inserted\nin the HashMap. The collection may reserve more space to speculatively\navoid frequent reallocations. After calling try_reserve,\ncapacity will be greater than or equal to self.len() + additional if\nit returns Ok(()).\nDoes nothing if capacity is already sufficient.

\n
§Errors
\n

If the capacity overflows, or the allocator reports a failure, then an error\nis returned.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map: HashMap<&str, isize> = HashMap::new();\nmap.try_reserve(10).expect(\"why is the test harness OOMing on a handful of bytes?\");
\n
1.0.0 · source

pub fn shrink_to_fit(&mut self)

Shrinks the capacity of the map as much as possible. It will drop\ndown as much as possible while maintaining the internal rules\nand possibly leaving some space in accordance with the resize policy.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map: HashMap<i32, i32> = HashMap::with_capacity(100);\nmap.insert(1, 2);\nmap.insert(3, 4);\nassert!(map.capacity() >= 100);\nmap.shrink_to_fit();\nassert!(map.capacity() >= 2);
\n
1.56.0 · source

pub fn shrink_to(&mut self, min_capacity: usize)

Shrinks the capacity of the map with a lower limit. It will drop\ndown no lower than the supplied limit while maintaining the internal rules\nand possibly leaving some space in accordance with the resize policy.

\n

If the current capacity is less than the lower limit, this is a no-op.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map: HashMap<i32, i32> = HashMap::with_capacity(100);\nmap.insert(1, 2);\nmap.insert(3, 4);\nassert!(map.capacity() >= 100);\nmap.shrink_to(10);\nassert!(map.capacity() >= 10);\nmap.shrink_to(0);\nassert!(map.capacity() >= 2);
\n
1.0.0 · source

pub fn entry(&mut self, key: K) -> Entry<'_, K, V>

Gets the given key’s corresponding entry in the map for in-place manipulation.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut letters = HashMap::new();\n\nfor ch in \"a short treatise on fungi\".chars() {\n    letters.entry(ch).and_modify(|counter| *counter += 1).or_insert(1);\n}\n\nassert_eq!(letters[&'s'], 2);\nassert_eq!(letters[&'t'], 3);\nassert_eq!(letters[&'u'], 1);\nassert_eq!(letters.get(&'y'), None);
\n
1.0.0 · source

pub fn get<Q>(&self, k: &Q) -> Option<&V>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Returns a reference to the value corresponding to the key.

\n

The key may be any borrowed form of the map’s key type, but\nHash and Eq on the borrowed form must match those for\nthe key type.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map = HashMap::new();\nmap.insert(1, \"a\");\nassert_eq!(map.get(&1), Some(&\"a\"));\nassert_eq!(map.get(&2), None);
\n
1.40.0 · source

pub fn get_key_value<Q>(&self, k: &Q) -> Option<(&K, &V)>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Returns the key-value pair corresponding to the supplied key.

\n

The supplied key may be any borrowed form of the map’s key type, but\nHash and Eq on the borrowed form must match those for\nthe key type.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map = HashMap::new();\nmap.insert(1, \"a\");\nassert_eq!(map.get_key_value(&1), Some((&1, &\"a\")));\nassert_eq!(map.get_key_value(&2), None);
\n
source

pub fn get_many_mut<Q, const N: usize>(\n &mut self,\n ks: [&Q; N],\n) -> Option<[&mut V; N]>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

🔬This is a nightly-only experimental API. (map_many_mut)

Attempts to get mutable references to N values in the map at once.

\n

Returns an array of length N with the results of each query. For soundness, at most one\nmutable reference will be returned to any value. None will be returned if any of the\nkeys are duplicates or missing.

\n
§Examples
\n
#![feature(map_many_mut)]\nuse std::collections::HashMap;\n\nlet mut libraries = HashMap::new();\nlibraries.insert(\"Bodleian Library\".to_string(), 1602);\nlibraries.insert(\"Athenæum\".to_string(), 1807);\nlibraries.insert(\"Herzogin-Anna-Amalia-Bibliothek\".to_string(), 1691);\nlibraries.insert(\"Library of Congress\".to_string(), 1800);\n\nlet got = libraries.get_many_mut([\n    \"Athenæum\",\n    \"Library of Congress\",\n]);\nassert_eq!(\n    got,\n    Some([\n        &mut 1807,\n        &mut 1800,\n    ]),\n);\n\n// Missing keys result in None\nlet got = libraries.get_many_mut([\n    \"Athenæum\",\n    \"New York Public Library\",\n]);\nassert_eq!(got, None);\n\n// Duplicate keys result in None\nlet got = libraries.get_many_mut([\n    \"Athenæum\",\n    \"Athenæum\",\n]);\nassert_eq!(got, None);
\n
source

pub unsafe fn get_many_unchecked_mut<Q, const N: usize>(\n &mut self,\n ks: [&Q; N],\n) -> Option<[&mut V; N]>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

🔬This is a nightly-only experimental API. (map_many_mut)

Attempts to get mutable references to N values in the map at once, without validating that\nthe values are unique.

\n

Returns an array of length N with the results of each query. None will be returned if\nany of the keys are missing.

\n

For a safe alternative see get_many_mut.

\n
§Safety
\n

Calling this method with overlapping keys is undefined behavior even if the resulting\nreferences are not used.

\n
§Examples
\n
#![feature(map_many_mut)]\nuse std::collections::HashMap;\n\nlet mut libraries = HashMap::new();\nlibraries.insert(\"Bodleian Library\".to_string(), 1602);\nlibraries.insert(\"Athenæum\".to_string(), 1807);\nlibraries.insert(\"Herzogin-Anna-Amalia-Bibliothek\".to_string(), 1691);\nlibraries.insert(\"Library of Congress\".to_string(), 1800);\n\nlet got = libraries.get_many_mut([\n    \"Athenæum\",\n    \"Library of Congress\",\n]);\nassert_eq!(\n    got,\n    Some([\n        &mut 1807,\n        &mut 1800,\n    ]),\n);\n\n// Missing keys result in None\nlet got = libraries.get_many_mut([\n    \"Athenæum\",\n    \"New York Public Library\",\n]);\nassert_eq!(got, None);
\n
1.0.0 · source

pub fn contains_key<Q>(&self, k: &Q) -> bool
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Returns true if the map contains a value for the specified key.

\n

The key may be any borrowed form of the map’s key type, but\nHash and Eq on the borrowed form must match those for\nthe key type.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map = HashMap::new();\nmap.insert(1, \"a\");\nassert_eq!(map.contains_key(&1), true);\nassert_eq!(map.contains_key(&2), false);
\n
1.0.0 · source

pub fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut V>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Returns a mutable reference to the value corresponding to the key.

\n

The key may be any borrowed form of the map’s key type, but\nHash and Eq on the borrowed form must match those for\nthe key type.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map = HashMap::new();\nmap.insert(1, \"a\");\nif let Some(x) = map.get_mut(&1) {\n    *x = \"b\";\n}\nassert_eq!(map[&1], \"b\");
\n
1.0.0 · source

pub fn insert(&mut self, k: K, v: V) -> Option<V>

Inserts a key-value pair into the map.

\n

If the map did not have this key present, None is returned.

\n

If the map did have this key present, the value is updated, and the old\nvalue is returned. The key is not updated, though; this matters for\ntypes that can be == without being identical. See the module-level\ndocumentation for more.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map = HashMap::new();\nassert_eq!(map.insert(37, \"a\"), None);\nassert_eq!(map.is_empty(), false);\n\nmap.insert(37, \"b\");\nassert_eq!(map.insert(37, \"c\"), Some(\"b\"));\nassert_eq!(map[&37], \"c\");
\n
source

pub fn try_insert(\n &mut self,\n key: K,\n value: V,\n) -> Result<&mut V, OccupiedError<'_, K, V>>

🔬This is a nightly-only experimental API. (map_try_insert)

Tries to insert a key-value pair into the map, and returns\na mutable reference to the value in the entry.

\n

If the map already had this key present, nothing is updated, and\nan error containing the occupied entry and the value is returned.

\n
§Examples
\n

Basic usage:

\n\n
#![feature(map_try_insert)]\n\nuse std::collections::HashMap;\n\nlet mut map = HashMap::new();\nassert_eq!(map.try_insert(37, \"a\").unwrap(), &\"a\");\n\nlet err = map.try_insert(37, \"b\").unwrap_err();\nassert_eq!(err.entry.key(), &37);\nassert_eq!(err.entry.get(), &\"a\");\nassert_eq!(err.value, \"b\");
\n
1.0.0 · source

pub fn remove<Q>(&mut self, k: &Q) -> Option<V>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Removes a key from the map, returning the value at the key if the key\nwas previously in the map.

\n

The key may be any borrowed form of the map’s key type, but\nHash and Eq on the borrowed form must match those for\nthe key type.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map = HashMap::new();\nmap.insert(1, \"a\");\nassert_eq!(map.remove(&1), Some(\"a\"));\nassert_eq!(map.remove(&1), None);
\n
1.27.0 · source

pub fn remove_entry<Q>(&mut self, k: &Q) -> Option<(K, V)>
where\n K: Borrow<Q>,\n Q: Hash + Eq + ?Sized,

Removes a key from the map, returning the stored key and value if the\nkey was previously in the map.

\n

The key may be any borrowed form of the map’s key type, but\nHash and Eq on the borrowed form must match those for\nthe key type.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet mut map = HashMap::new();\nmap.insert(1, \"a\");\nassert_eq!(map.remove_entry(&1), Some((1, \"a\")));\nassert_eq!(map.remove(&1), None);
\n
",0,"hydro_lang::ir::SeenTees"],["
§

impl<K, V, S> HashMapExt for HashMap<K, V, S>
where\n S: BuildHasher + Default,

§

fn new() -> HashMap<K, V, S>

Constructs a new HashMap
§

fn with_capacity(capacity: usize) -> HashMap<K, V, S>

Constructs a new HashMap with a given initial capacity
","HashMapExt","hydro_lang::ir::SeenTees"],["
1.0.0 · source§

impl<K, Q, V, S> Index<&Q> for HashMap<K, V, S>
where\n K: Eq + Hash + Borrow<Q>,\n Q: Eq + Hash + ?Sized,\n S: BuildHasher,

source§

fn index(&self, key: &Q) -> &V

Returns a reference to the value corresponding to the supplied key.

\n
§Panics
\n

Panics if the key is not present in the HashMap.

\n
source§

type Output = V

The returned type after indexing.
","Index<&Q>","hydro_lang::ir::SeenTees"],["
source§

impl<'de, K, V, S, E> IntoDeserializer<'de, E> for HashMap<K, V, S>
where\n K: IntoDeserializer<'de, E> + Eq + Hash,\n V: IntoDeserializer<'de, E>,\n S: BuildHasher,\n E: Error,

source§

type Deserializer = MapDeserializer<'de, <HashMap<K, V, S> as IntoIterator>::IntoIter, E>

The type of the deserializer being converted into.
source§

fn into_deserializer(\n self,\n) -> <HashMap<K, V, S> as IntoDeserializer<'de, E>>::Deserializer

Convert this value into a deserializer.
","IntoDeserializer<'de, E>","hydro_lang::ir::SeenTees"],["
1.0.0 · source§

impl<K, V, S> IntoIterator for HashMap<K, V, S>

source§

fn into_iter(self) -> IntoIter<K, V>

Creates a consuming iterator, that is, one that moves each key-value\npair out of the map in arbitrary order. The map cannot be used after\ncalling this.

\n
§Examples
\n
use std::collections::HashMap;\n\nlet map = HashMap::from([\n    (\"a\", 1),\n    (\"b\", 2),\n    (\"c\", 3),\n]);\n\n// Not possible with .iter()\nlet vec: Vec<(&str, i32)> = map.into_iter().collect();
\n
source§

type Item = (K, V)

The type of the elements being iterated over.
source§

type IntoIter = IntoIter<K, V>

Which kind of iterator are we turning this into?
","IntoIterator","hydro_lang::ir::SeenTees"],["
§

impl<K, V> Iter for HashMap<K, V>

§

type Iter<'a> = Values<'a, K, V>\nwhere\n HashMap<K, V>: 'a

Iterator type.
§

fn iter(&self) -> <HashMap<K, V> as Iter>::Iter<'_>

Create an iterator over the items of the collection.
","Iter","hydro_lang::ir::SeenTees"],["
§

impl<K, V> Keyed for HashMap<K, V>

§

type Key = K

Type of the keys indexing each item of the collection.
","Keyed","hydro_lang::ir::SeenTees"],["
§

impl<K, V> KeyedRef for HashMap<K, V>

§

type KeyRef<'a> = &'a K\nwhere\n HashMap<K, V>: 'a

Type of references to keys of the collection.
§

fn upcast_key_ref<'short, 'long>(\n r: <HashMap<K, V> as KeyedRef>::KeyRef<'long>,\n) -> <HashMap<K, V> as KeyedRef>::KeyRef<'short>
where\n 'long: 'short,\n HashMap<K, V>: 'long,

Changes a key reference into a shorter lived reference. Read more
","KeyedRef","hydro_lang::ir::SeenTees"],["
§

impl<K, V> Len for HashMap<K, V>

§

fn len(&self) -> usize

Returns the number of elements in the collection.
§

fn is_empty(&self) -> bool

Checks if the collection is empty.
","Len","hydro_lang::ir::SeenTees"],["
§

impl<K, V> MapInsert<K> for HashMap<K, V>
where\n K: Hash + Eq,

§

type Output = Option<V>

The output of the insertion function.
§

fn insert(&mut self, key: K, value: V) -> Option<V>

Insert a new key-value pair in the collection.
","MapInsert","hydro_lang::ir::SeenTees"],["
§

impl<K, V> MapIter for HashMap<K, V>

§

type Iter<'a> = Iter<'a, K, V>\nwhere\n HashMap<K, V>: 'a

§

fn iter(&self) -> <HashMap<K, V> as MapIter>::Iter<'_>

","MapIter","hydro_lang::ir::SeenTees"],["
§

impl<K, V> MapIterMut for HashMap<K, V>

§

type IterMut<'a> = IterMut<'a, K, V>\nwhere\n HashMap<K, V>: 'a

§

fn iter_mut(&mut self) -> <HashMap<K, V> as MapIterMut>::IterMut<'_>

","MapIterMut","hydro_lang::ir::SeenTees"],["
§

impl<Key, OldVal> MapMapValues<OldVal> for HashMap<Key, OldVal>
where\n Key: Eq + Hash,

§

type MapValue<NewVal> = HashMap<Key, NewVal>

Output type, should be Self but with OldVal replaced with NewVal.
§

fn map_values<NewVal, MapFn>(\n self,\n map_fn: MapFn,\n) -> <HashMap<Key, OldVal> as MapMapValues<OldVal>>::MapValue<NewVal>
where\n MapFn: FnMut(OldVal) -> NewVal,

Map the values into using the map_fn.
","MapMapValues","hydro_lang::ir::SeenTees"],["
1.0.0 · source§

impl<K, V, S> PartialEq for HashMap<K, V, S>
where\n K: Eq + Hash,\n V: PartialEq,\n S: BuildHasher,

source§

fn eq(&self, other: &HashMap<K, V, S>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient,\nand should not be overridden without very good reason.
","PartialEq","hydro_lang::ir::SeenTees"],["
§

impl<'a, Q, K, V> Remove<&'a Q> for HashMap<K, V>
where\n K: Hash + Eq + Borrow<Q>,\n Q: Hash + Eq + ?Sized,

§

fn remove(&mut self, key: &'a Q) -> Option<V>

Remove the element identified by the given key.
","Remove<&'a Q>","hydro_lang::ir::SeenTees"],["
source§

impl<K, V, H> Serialize for HashMap<K, V, H>
where\n K: Serialize,\n V: Serialize,

source§

fn serialize<S>(\n &self,\n serializer: S,\n) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where\n S: Serializer,

Serialize this value into the given Serde serializer. Read more
","Serialize","hydro_lang::ir::SeenTees"],["
§

impl<K, V> SimpleCollectionMut for HashMap<K, V>

§

fn into_mut<'r>(\n r: <HashMap<K, V> as CollectionMut>::ItemMut<'r>,\n) -> &'r mut <HashMap<K, V> as Collection>::Item
where\n HashMap<K, V>: 'r,

","SimpleCollectionMut","hydro_lang::ir::SeenTees"],["
§

impl<K, V> SimpleCollectionRef for HashMap<K, V>

§

fn into_ref<'r>(\n r: <HashMap<K, V> as CollectionRef>::ItemRef<'r>,\n) -> &'r <HashMap<K, V> as Collection>::Item
where\n HashMap<K, V>: 'r,

","SimpleCollectionRef","hydro_lang::ir::SeenTees"],["
§

impl<K, V> SimpleKeyedRef for HashMap<K, V>

§

fn into_ref<'r>(\n r: <HashMap<K, V> as KeyedRef>::KeyRef<'r>,\n) -> &'r <HashMap<K, V> as Keyed>::Key
where\n HashMap<K, V>: 'r,

","SimpleKeyedRef","hydro_lang::ir::SeenTees"],["
1.0.0 · source§

impl<K, V, S> Eq for HashMap<K, V, S>
where\n K: Eq + Hash,\n V: Eq,\n S: BuildHasher,

","Eq","hydro_lang::ir::SeenTees"],["
1.36.0 · source§

impl<K, V, S> UnwindSafe for HashMap<K, V, S>
where\n K: UnwindSafe,\n V: UnwindSafe,\n S: UnwindSafe,

","UnwindSafe","hydro_lang::ir::SeenTees"]]]]); if (window.register_type_impls) { window.register_type_impls(type_impls); } else { window.pending_type_impls = type_impls; } })() -//{"start":55,"fragment_lengths":[172934]} \ No newline at end of file +//{"start":55,"fragment_lengths":[172101]} \ No newline at end of file