Lines Matching defs:HashMap
11 /// Default hasher for `HashMap`.
15 /// Dummy default hasher for `HashMap`.
26 /// The hashing algorithm can be replaced on a per-`HashMap` basis using the
48 /// panic does occur then the contents of the `HashMap` may become corrupted and
54 /// use hashbrown::HashMap;
57 /// // would be `HashMap<String, String>` in this example).
58 /// let mut book_reviews = HashMap::new();
107 /// `HashMap` also implements an [`Entry API`](#method.entry), which allows
112 /// use hashbrown::HashMap;
115 /// // would be `HashMap<&str, u8>` in this example).
116 /// let mut player_stats = HashMap::new();
136 /// The easiest way to use `HashMap` with a custom key type is to derive [`Eq`] and [`Hash`].
151 /// use hashbrown::HashMap;
166 /// // Use a HashMap to store the vikings' health points.
167 /// let mut vikings = HashMap::new();
179 /// A `HashMap` with fixed list of elements can be initialized from an array:
182 /// use hashbrown::HashMap;
184 /// let timber_resources: HashMap<&str, i32> = [("Norway", 100), ("Denmark", 50), ("Iceland", 10)]
188 pub struct HashMap<K, V, S = DefaultHashBuilder, A: Allocator + Clone = Global> {
193 impl<K: Clone, V: Clone, S: Clone, A: Allocator + Clone> Clone for HashMap<K, V, S, A> {
195 HashMap {
292 impl<K, V> HashMap<K, V, DefaultHashBuilder> {
293 /// Creates an empty `HashMap`.
301 /// use hashbrown::HashMap;
302 /// let mut map: HashMap<&str, i32> = HashMap::new();
311 /// Creates an empty `HashMap` with the specified capacity.
319 /// use hashbrown::HashMap;
320 /// let mut map: HashMap<&str, i32> = HashMap::with_capacity(10);
331 impl<K, V, A: Allocator + Clone> HashMap<K, V, DefaultHashBuilder, A> {
332 /// Creates an empty `HashMap` using the given allocator.
341 /// Creates an empty `HashMap` with the specified capacity using the given allocator.
351 impl<K, V, S> HashMap<K, V, S> {
352 /// Creates an empty `HashMap` which will use the given hash builder to hash
364 /// the HashMap to be useful, see its documentation for details.
369 /// use hashbrown::HashMap;
373 /// let mut map = HashMap::with_hasher(s);
389 /// Creates an empty `HashMap` with the specified capacity, using `hash_builder`
401 /// the HashMap to be useful, see its documentation for details.
406 /// use hashbrown::HashMap;
410 /// let mut map = HashMap::with_capacity_and_hasher(10, s);
427 impl<K, V, S, A: Allocator + Clone> HashMap<K, V, S, A> {
434 /// Creates an empty `HashMap` which will use the given hash builder to hash
447 /// use hashbrown::HashMap;
451 /// let mut map = HashMap::with_hasher(s);
462 /// Creates an empty `HashMap` with the specified capacity, using `hash_builder`
476 /// use hashbrown::HashMap;
480 /// let mut map = HashMap::with_capacity_and_hasher(10, s);
498 /// use hashbrown::HashMap;
502 /// let map: HashMap<i32, i32> = HashMap::with_hasher(hasher);
512 /// This number is a lower bound; the `HashMap<K, V>` might be able to hold
518 /// use hashbrown::HashMap;
519 /// let map: HashMap<i32, i32> = HashMap::with_capacity(100);
534 /// use hashbrown::HashMap;
536 /// let mut map = HashMap::new();
566 /// use hashbrown::HashMap;
568 /// let mut map = HashMap::new();
598 /// use hashbrown::HashMap;
600 /// let mut map = HashMap::new();
638 /// use hashbrown::HashMap;
640 /// let mut map = HashMap::new();
677 /// use hashbrown::HashMap;
679 /// let mut map = HashMap::new();
726 /// use hashbrown::HashMap;
728 /// let mut a = HashMap::new();
743 /// use hashbrown::HashMap;
745 /// let mut a = HashMap::new();
765 /// use hashbrown::HashMap;
767 /// let mut a = HashMap::new();
782 /// let mut a = HashMap::new();
809 /// use hashbrown::HashMap;
811 /// let mut map: HashMap<i32, i32> = (0..8).map(|x|(x, x*10)).collect();
862 /// use hashbrown::HashMap;
864 /// let mut map: HashMap<i32, i32> = (0..8).map(|x| (x, x)).collect();
866 /// let drained: HashMap<i32, i32> = map.drain_filter(|k, _v| k % 2 == 0).collect();
878 /// let mut map: HashMap<i32, i32> = (0..8).map(|x| (x, x)).collect();
908 /// use hashbrown::HashMap;
910 /// let mut a = HashMap::new();
933 /// use hashbrown::HashMap;
935 /// let mut map = HashMap::new();
961 /// use hashbrown::HashMap;
963 /// let mut map = HashMap::new();
983 impl<K, V, S, A> HashMap<K, V, S, A>
990 /// in the `HashMap`. The collection may reserve more space to avoid
1002 /// use hashbrown::HashMap;
1003 /// let mut map: HashMap<&str, i32> = HashMap::new();
1019 /// in the given `HashMap<K,V>`. The collection may reserve more space to avoid
1030 /// use hashbrown::HashMap;
1032 /// let mut map: HashMap<&str, isize> = HashMap::new();
1045 /// use hashbrown::HashMap;
1047 /// let mut map: HashMap<i32, i32> = HashMap::new();
1075 /// use hashbrown::HashMap;
1077 /// let mut map: HashMap<i32, i32> = HashMap::with_capacity(100);
1100 /// use hashbrown::HashMap;
1102 /// let mut map: HashMap<i32, i32> = HashMap::with_capacity(100);
1124 /// use hashbrown::HashMap;
1126 /// let mut letters = HashMap::new();
1162 /// use hashbrown::HashMap;
1164 /// let mut words: HashMap<String, usize> = HashMap::new();
1209 /// use hashbrown::HashMap;
1211 /// let mut map = HashMap::new();
1241 /// use hashbrown::HashMap;
1243 /// let mut map = HashMap::new();
1287 /// use hashbrown::HashMap;
1289 /// let mut map = HashMap::new();
1323 /// use hashbrown::HashMap;
1325 /// let mut map = HashMap::new();
1351 /// use hashbrown::HashMap;
1353 /// let mut map = HashMap::new();
1398 /// use hashbrown::HashMap;
1400 /// let mut libraries = HashMap::new();
1446 /// For a safe alternative see [`get_many_mut`](`HashMap::get_many_mut`).
1458 /// use hashbrown::HashMap;
1460 /// let mut libraries = HashMap::new();
1507 /// use hashbrown::HashMap;
1509 /// let mut libraries = HashMap::new();
1559 /// For a safe alternative see [`get_many_key_value_mut`](`HashMap::get_many_key_value_mut`).
1571 /// use hashbrown::HashMap;
1573 /// let mut libraries = HashMap::new();
1663 /// use hashbrown::HashMap;
1665 /// let mut map = HashMap::new();
1709 /// use hashbrown::HashMap;
1711 /// let mut map1 = HashMap::new();
1717 /// let mut map2 = HashMap::new();
1757 /// use hashbrown::HashMap;
1760 /// let mut map = HashMap::new();
1797 /// use hashbrown::HashMap;
1799 /// let mut map = HashMap::new();
1838 /// use hashbrown::HashMap;
1840 /// let mut map = HashMap::new();
1864 impl<K, V, S, A: Allocator + Clone> HashMap<K, V, S, A> {
1865 /// Creates a raw entry builder for the HashMap.
1880 /// to put the HashMap into an inconsistent state which, while memory-safe,
1886 /// This is because implementations of HashMap may need to recompute hashes
1901 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
1903 /// let mut map = HashMap::new();
1967 /// Creates a raw immutable entry builder for the HashMap.
1987 /// use hashbrown::HashMap;
1989 /// let mut map = HashMap::new();
2016 /// Returns a mutable reference to the [`RawTable`] used underneath [`HashMap`].
2025 /// for extending the HashMap's API, but may lead to *[undefined behavior]*.
2027 /// [`HashMap`]: struct.HashMap.html
2035 /// use hashbrown::HashMap;
2037 /// let mut map = HashMap::new();
2045 /// map: &mut HashMap<K, V, S>,
2078 impl<K, V, S, A> PartialEq for HashMap<K, V, S, A>
2095 impl<K, V, S, A> Eq for HashMap<K, V, S, A>
2104 impl<K, V, S, A> Debug for HashMap<K, V, S, A>
2115 impl<K, V, S, A> Default for HashMap<K, V, S, A>
2120 /// Creates an empty `HashMap<K, V, S, A>`, with the `Default` value for the hasher and allocator.
2125 /// use hashbrown::HashMap;
2128 /// // You can specify all types of HashMap, including hasher and allocator.
2130 /// let map: HashMap<u32, String> = Default::default();
2132 /// let map: HashMap<u32, String, RandomState> = HashMap::default();
2141 impl<K, Q: ?Sized, V, S, A> Index<&Q> for HashMap<K, V, S, A>
2154 /// Panics if the key is not present in the `HashMap`.
2159 /// use hashbrown::HashMap;
2161 /// let map: HashMap<_, _> = [("a", "One"), ("b", "Two")].into();
2174 impl<K, V, A, const N: usize> From<[(K, V); N]> for HashMap<K, V, DefaultHashBuilder, A>
2182 /// use hashbrown::HashMap;
2184 /// let map1 = HashMap::from([(1, 2), (3, 4)]);
2185 /// let map2: HashMap<_, _> = [(1, 2), (3, 4)].into();
2193 /// An iterator over the entries of a `HashMap` in arbitrary order.
2196 /// This `struct` is created by the [`iter`] method on [`HashMap`]. See its
2199 /// [`iter`]: struct.HashMap.html#method.iter
2200 /// [`HashMap`]: struct.HashMap.html
2205 /// use hashbrown::HashMap;
2207 /// let map: HashMap<_, _> = [(1, "a"), (2, "b"), (3, "c")].into();
2243 /// A mutable iterator over the entries of a `HashMap` in arbitrary order.
2246 /// This `struct` is created by the [`iter_mut`] method on [`HashMap`]. See its
2249 /// [`iter_mut`]: struct.HashMap.html#method.iter_mut
2250 /// [`HashMap`]: struct.HashMap.html
2255 /// use hashbrown::HashMap;
2257 /// let mut map: HashMap<_, _> = [(1, "One".to_owned()), (2, "Two".into())].into();
2292 /// An owning iterator over the entries of a `HashMap` in arbitrary order.
2295 /// This `struct` is created by the [`into_iter`] method on [`HashMap`]
2299 /// [`into_iter`]: struct.HashMap.html#method.into_iter
2300 /// [`HashMap`]: struct.HashMap.html
2306 /// use hashbrown::HashMap;
2308 /// let map: HashMap<_, _> = [(1, "a"), (2, "b"), (3, "c")].into();
2337 /// An owning iterator over the keys of a `HashMap` in arbitrary order.
2340 /// This `struct` is created by the [`into_keys`] method on [`HashMap`].
2344 /// [`into_keys`]: struct.HashMap.html#method.into_keys
2345 /// [`HashMap`]: struct.HashMap.html
2350 /// use hashbrown::HashMap;
2352 /// let map: HashMap<_, _> = [(1, "a"), (2, "b"), (3, "c")].into();
2400 /// An owning iterator over the values of a `HashMap` in arbitrary order.
2403 /// This `struct` is created by the [`into_values`] method on [`HashMap`].
2406 /// [`into_values`]: struct.HashMap.html#method.into_values
2407 /// [`HashMap`]: struct.HashMap.html
2412 /// use hashbrown::HashMap;
2414 /// let map: HashMap<_, _> = [(1, "a"), (2, "b"), (3, "c")].into();
2462 /// An iterator over the keys of a `HashMap` in arbitrary order.
2465 /// This `struct` is created by the [`keys`] method on [`HashMap`]. See its
2468 /// [`keys`]: struct.HashMap.html#method.keys
2469 /// [`HashMap`]: struct.HashMap.html
2474 /// use hashbrown::HashMap;
2476 /// let map: HashMap<_, _> = [(1, "a"), (2, "b"), (3, "c")].into();
2510 /// An iterator over the values of a `HashMap` in arbitrary order.
2513 /// This `struct` is created by the [`values`] method on [`HashMap`]. See its
2516 /// [`values`]: struct.HashMap.html#method.values
2517 /// [`HashMap`]: struct.HashMap.html
2522 /// use hashbrown::HashMap;
2524 /// let map: HashMap<_, _> = [(1, "a"), (2, "b"), (3, "c")].into();
2558 /// A draining iterator over the entries of a `HashMap` in arbitrary
2561 /// This `struct` is created by the [`drain`] method on [`HashMap`]. See its
2564 /// [`drain`]: struct.HashMap.html#method.drain
2565 /// [`HashMap`]: struct.HashMap.html
2570 /// use hashbrown::HashMap;
2572 /// let mut map: HashMap<_, _> = [(1, "a"), (2, "b"), (3, "c")].into();
2601 /// A draining iterator over entries of a `HashMap` which don't satisfy the predicate
2604 /// This `struct` is created by the [`drain_filter`] method on [`HashMap`]. See its
2607 /// [`drain_filter`]: struct.HashMap.html#method.drain_filter
2608 /// [`HashMap`]: struct.HashMap.html
2613 /// use hashbrown::HashMap;
2615 /// let mut map: HashMap<i32, &str> = [(1, "a"), (2, "b"), (3, "c")].into();
2708 /// A mutable iterator over the values of a `HashMap` in arbitrary order.
2711 /// This `struct` is created by the [`values_mut`] method on [`HashMap`]. See its
2714 /// [`values_mut`]: struct.HashMap.html#method.values_mut
2715 /// [`HashMap`]: struct.HashMap.html
2720 /// use hashbrown::HashMap;
2722 /// let mut map: HashMap<_, _> = [(1, "One".to_owned()), (2, "Two".into())].into();
2739 /// A builder for computing where in a [`HashMap`] a key-value pair would be stored.
2741 /// See the [`HashMap::raw_entry_mut`] docs for usage examples.
2743 /// [`HashMap::raw_entry_mut`]: struct.HashMap.html#method.raw_entry_mut
2749 /// use hashbrown::HashMap;
2752 /// let mut map = HashMap::new();
2795 map: &'a mut HashMap<K, V, S, A>,
2802 /// This `enum` is constructed through the [`raw_entry_mut`] method on [`HashMap`],
2805 /// [`HashMap`]: struct.HashMap.html
2807 /// [`raw_entry_mut`]: struct.HashMap.html#method.raw_entry_mut
2814 /// use hashbrown::hash_map::{HashMap, RawEntryMut, RawOccupiedEntryMut};
2816 /// let mut map = HashMap::new();
2874 /// println!("Our HashMap: {:?}", map);
2888 /// use hashbrown::{hash_map::RawEntryMut, HashMap};
2889 /// let mut map: HashMap<_, _> = [("a", 100), ("b", 200)].into();
2902 /// use hashbrown::{hash_map::RawEntryMut, HashMap};
2903 /// let mut map: HashMap<&str, i32> = HashMap::new();
2913 /// A view into an occupied entry in a `HashMap`.
2922 /// use hashbrown::hash_map::{HashMap, RawEntryMut, RawOccupiedEntryMut};
2924 /// let mut map = HashMap::new();
2996 /// A view into a vacant entry in a `HashMap`.
3005 /// use hashbrown::hash_map::{HashMap, RawEntryMut, RawVacantEntryMut};
3007 /// let mut map = HashMap::<&str, i32>::new();
3049 /// A builder for computing where in a [`HashMap`] a key-value pair would be stored.
3051 /// See the [`HashMap::raw_entry`] docs for usage examples.
3053 /// [`HashMap::raw_entry`]: struct.HashMap.html#method.raw_entry
3058 /// use hashbrown::hash_map::{HashMap, RawEntryBuilder};
3061 /// let mut map = HashMap::new();
3084 map: &'a HashMap<K, V, S, A>,
3093 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3095 /// let mut map: HashMap<&str, u32> = HashMap::new();
3119 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3128 /// let mut map: HashMap<&str, u32> = HashMap::new();
3153 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3162 /// let mut map: HashMap<&str, u32> = HashMap::new();
3203 /// use hashbrown::HashMap;
3205 /// let map: HashMap<&str, u32> = [("a", 100), ("b", 200)].into();
3227 /// use hashbrown::HashMap;
3236 /// let map: HashMap<&str, u32> = [("a", 100), ("b", 200)].into();
3268 /// use hashbrown::HashMap;
3277 /// let map: HashMap<&str, u32> = [("a", 100), ("b", 200)].into();
3298 /// use hashbrown::HashMap;
3300 /// let mut map: HashMap<&str, u32> = HashMap::new();
3326 /// use hashbrown::HashMap;
3328 /// let mut map: HashMap<&str, u32> = HashMap::new();
3354 /// use hashbrown::HashMap;
3356 /// let mut map: HashMap<&str, String> = HashMap::new();
3386 /// use hashbrown::HashMap;
3388 /// let mut map: HashMap<&str, u32> = HashMap::new();
3426 /// use hashbrown::HashMap;
3429 /// let mut map: HashMap<&str, u32> = HashMap::new();
3492 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3494 /// let mut map: HashMap<&str, u32> = [("a", 100), ("b", 200)].into();
3511 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3517 /// let mut map: HashMap<Rc<&str>, u32> = HashMap::new();
3543 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3549 /// let mut map: HashMap<Rc<&str>, u32> = HashMap::new();
3576 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3578 /// let mut map: HashMap<&str, u32> = [("a", 100), ("b", 200)].into();
3596 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3598 /// let mut map: HashMap<&str, u32> = [("a", 100), ("b", 200)].into();
3620 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3622 /// let mut map: HashMap<&str, u32> = [("a", 100), ("b", 200)].into();
3641 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3643 /// let mut map: HashMap<&str, u32> = [("a", 100), ("b", 200)].into();
3663 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3669 /// let mut map: HashMap<Rc<&str>, u32> = HashMap::new();
3700 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3706 /// let mut map: HashMap<Rc<&str>, u32> = HashMap::new();
3740 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3742 /// let mut map: HashMap<&str, u32> = [("a", 100), ("b", 200)].into();
3761 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3767 /// let mut map: HashMap<Rc<&str>, u32> = HashMap::new();
3793 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3795 /// let mut map: HashMap<&str, u32> = [("a", 100), ("b", 200)].into();
3813 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3815 /// let mut map: HashMap<&str, u32> = [("a", 100), ("b", 200)].into();
3835 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3837 /// let mut map: HashMap<&str, u32> = [("a", 100), ("b", 200)].into();
3892 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3894 /// let mut map: HashMap<&str, u32> = [("a", 100), ("b", 200)].into();
3920 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3929 /// let mut map: HashMap<&str, u32> = [("a", 100), ("b", 200)].into();
3964 /// use hashbrown::hash_map::{HashMap, RawEntryMut};
3979 /// let mut map: HashMap<&str, u32> = HashMap::new();
4069 /// This `enum` is constructed from the [`entry`] method on [`HashMap`].
4071 /// [`HashMap`]: struct.HashMap.html
4072 /// [`entry`]: struct.HashMap.html#method.entry
4077 /// use hashbrown::hash_map::{Entry, HashMap, OccupiedEntry};
4079 /// let mut map = HashMap::new();
4102 /// println!("Our HashMap: {:?}", map);
4119 /// use hashbrown::hash_map::{Entry, HashMap};
4120 /// let mut map: HashMap<_, _> = [("a", 100), ("b", 200)].into();
4134 /// use hashbrown::hash_map::{Entry, HashMap};
4135 /// let mut map: HashMap<&str, i32> = HashMap::new();
4154 /// A view into an occupied entry in a `HashMap`.
4162 /// use hashbrown::hash_map::{Entry, HashMap, OccupiedEntry};
4164 /// let mut map = HashMap::new();
4198 table: &'a mut HashMap<K, V, S, A>,
4227 /// A view into a vacant entry in a `HashMap`.
4235 /// use hashbrown::hash_map::{Entry, HashMap, VacantEntry};
4237 /// let mut map = HashMap::<&str, i32>::new();
4260 table: &'a mut HashMap<K, V, S, A>,
4273 /// This `enum` is constructed from the [`entry_ref`] method on [`HashMap`].
4279 /// [`HashMap`]: struct.HashMap.html
4280 /// [`entry_ref`]: struct.HashMap.html#method.entry_ref
4288 /// use hashbrown::hash_map::{EntryRef, HashMap, OccupiedEntryRef};
4290 /// let mut map = HashMap::new();
4314 /// println!("Our HashMap: {:?}", map);
4330 /// use hashbrown::hash_map::{EntryRef, HashMap};
4331 /// let mut map: HashMap<_, _> = [("a".to_owned(), 100), ("b".into(), 200)].into();
4345 /// use hashbrown::hash_map::{EntryRef, HashMap};
4346 /// let mut map: HashMap<String, i32> = HashMap::new();
4393 /// A view into an occupied entry in a `HashMap`.
4401 /// use hashbrown::hash_map::{EntryRef, HashMap, OccupiedEntryRef};
4403 /// let mut map = HashMap::new();
4438 table: &'a mut HashMap<K, V, S, A>,
4471 /// A view into a vacant entry in a `HashMap`.
4479 /// use hashbrown::hash_map::{EntryRef, HashMap, VacantEntryRef};
4481 /// let mut map = HashMap::<String, i32>::new();
4504 table: &'a mut HashMap<K, V, S, A>,
4515 /// The error returned by [`try_insert`](HashMap::try_insert) when the key already exists.
4522 /// use hashbrown::hash_map::{HashMap, OccupiedError};
4524 /// let mut map: HashMap<_, _> = [("a", 10), ("b", 20)].into();
4570 impl<'a, K, V, S, A: Allocator + Clone> IntoIterator for &'a HashMap<K, V, S, A> {
4574 /// Creates an iterator over the entries of a `HashMap` in arbitrary order.
4577 /// Return the same `Iter` struct as by the [`iter`] method on [`HashMap`].
4579 /// [`iter`]: struct.HashMap.html#method.iter
4580 /// [`HashMap`]: struct.HashMap.html
4585 /// use hashbrown::HashMap;
4586 /// let map_one: HashMap<_, _> = [(1, "a"), (2, "b"), (3, "c")].into();
4587 /// let mut map_two = HashMap::new();
4602 impl<'a, K, V, S, A: Allocator + Clone> IntoIterator for &'a mut HashMap<K, V, S, A> {
4606 /// Creates an iterator over the entries of a `HashMap` in arbitrary order
4611 /// [`HashMap`].
4613 /// [`iter_mut`]: struct.HashMap.html#method.iter_mut
4614 /// [`HashMap`]: struct.HashMap.html
4619 /// use hashbrown::HashMap;
4620 /// let mut map: HashMap<_, _> = [("a", 1), ("b", 2), ("c", 3)].into();
4639 impl<K, V, S, A: Allocator + Clone> IntoIterator for HashMap<K, V, S, A> {
4650 /// use hashbrown::HashMap;
4652 /// let map: HashMap<_, _> = [("a", 1), ("b", 2), ("c", 3)].into();
4877 /// use hashbrown::HashMap;
4879 /// let mut map: HashMap<&str, u32> = HashMap::new();
4905 /// use hashbrown::HashMap;
4907 /// let mut map: HashMap<&str, u32> = HashMap::new();
4935 /// use hashbrown::HashMap;
4937 /// let mut map: HashMap<&str, u32> = HashMap::new();
4969 /// use hashbrown::HashMap;
4971 /// let mut map: HashMap<&str, usize> = HashMap::new();
5001 /// use hashbrown::HashMap;
5003 /// let mut map: HashMap<&str, u32> = HashMap::new();
5024 /// use hashbrown::HashMap;
5026 /// let mut map: HashMap<&str, u32> = HashMap::new();
5059 /// use hashbrown::HashMap;
5062 /// let mut map: HashMap<&str, u32> = HashMap::new();
5125 /// use hashbrown::HashMap;
5127 /// let mut map: HashMap<&str, Option<u32>> = HashMap::new();
5157 /// use hashbrown::hash_map::{Entry, HashMap};
5159 /// let mut map: HashMap<&str, u32> = HashMap::new();
5178 /// use hashbrown::HashMap;
5181 /// let mut map: HashMap<&str, u32> = HashMap::new();
5207 /// use hashbrown::HashMap;
5210 /// let mut map: HashMap<&str, u32> = HashMap::new();
5233 /// use hashbrown::HashMap;
5236 /// let mut map: HashMap<&str, u32> = HashMap::new();
5265 /// use hashbrown::hash_map::{Entry, HashMap};
5267 /// let mut map: HashMap<&str, u32> = HashMap::new();
5291 /// use hashbrown::HashMap;
5294 /// let mut map: HashMap<&str, u32> = HashMap::new();
5314 /// use hashbrown::HashMap;
5317 /// let mut map: HashMap<&str, u32> = HashMap::new();
5347 /// use hashbrown::hash_map::{Entry, HashMap};
5350 /// let mut map: HashMap<Rc<String>, u32> = HashMap::new();
5387 /// use hashbrown::hash_map::{Entry, HashMap};
5390 /// let mut map: HashMap<Rc<String>, usize> = HashMap::with_capacity(6);
5413 /// fn reclaim_memory(map: &mut HashMap<Rc<String>, usize>, keys: &[Rc<String>]) {
5435 /// use hashbrown::HashMap;
5438 /// let mut map: HashMap<&str, u32> = HashMap::new();
5515 /// use hashbrown::HashMap;
5517 /// let mut map: HashMap<&str, u32> = HashMap::new();
5530 /// use hashbrown::hash_map::{Entry, HashMap};
5532 /// let mut map: HashMap<&str, u32> = HashMap::new();
5550 /// use hashbrown::HashMap;
5553 /// let mut map: HashMap<&str, u32> = HashMap::new();
5601 /// use hashbrown::HashMap;
5603 /// let mut map: HashMap<String, u32> = HashMap::new();
5629 /// use hashbrown::HashMap;
5631 /// let mut map: HashMap<String, u32> = HashMap::new();
5659 /// use hashbrown::HashMap;
5661 /// let mut map: HashMap<String, u32> = HashMap::new();
5693 /// use hashbrown::HashMap;
5695 /// let mut map: HashMap<String, usize> = HashMap::new();
5725 /// use hashbrown::HashMap;
5727 /// let mut map: HashMap<String, u32> = HashMap::new();
5751 /// use hashbrown::HashMap;
5753 /// let mut map: HashMap<String, u32> = HashMap::new();
5786 /// use hashbrown::HashMap;
5789 /// let mut map: HashMap<String, u32> = HashMap::new();
5853 /// use hashbrown::HashMap;
5855 /// let mut map: HashMap<String, Option<u32>> = HashMap::new();
5885 /// use hashbrown::hash_map::{EntryRef, HashMap};
5887 /// let mut map: HashMap<String, u32> = HashMap::new();
5909 /// use hashbrown::HashMap;
5912 /// let mut map: HashMap<String, u32> = HashMap::new();
5938 /// use hashbrown::HashMap;
5941 /// let mut map: HashMap<String, u32> = HashMap::new();
5964 /// use hashbrown::HashMap;
5967 /// let mut map: HashMap<String, u32> = HashMap::new();
5996 /// use hashbrown::hash_map::{EntryRef, HashMap};
5998 /// let mut map: HashMap<String, u32> = HashMap::new();
6020 /// use hashbrown::HashMap;
6023 /// let mut map: HashMap<String, u32> = HashMap::new();
6043 /// use hashbrown::HashMap;
6046 /// let mut map: HashMap<String, u32> = HashMap::new();
6076 /// use hashbrown::hash_map::{EntryRef, HashMap};
6079 /// let mut map: HashMap<Rc<str>, u32> = HashMap::new();
6118 /// use hashbrown::hash_map::{EntryRef, HashMap};
6121 /// let mut map: HashMap<Rc<str>, usize> = HashMap::with_capacity(6);
6138 /// fn reclaim_memory(map: &mut HashMap<Rc<str>, usize>, keys: &[Rc<str>]) {
6163 /// use hashbrown::HashMap;
6166 /// let mut map: HashMap<String, u32> = HashMap::new();
6244 /// use hashbrown::HashMap;
6246 /// let mut map: HashMap<String, u32> = HashMap::new();
6263 /// use hashbrown::hash_map::{EntryRef, HashMap};
6265 /// let mut map: HashMap<String, u32> = HashMap::new();
6287 /// use hashbrown::HashMap;
6290 /// let mut map: HashMap<String, u32> = HashMap::new();
6333 impl<K, V, S, A> FromIterator<(K, V)> for HashMap<K, V, S, A>
6353 impl<K, V, S, A> Extend<(K, V)> for HashMap<K, V, S, A>
6359 /// Inserts all new key-values from the iterator to existing `HashMap<K, V, S, A>`.
6365 /// use hashbrown::hash_map::HashMap;
6367 /// let mut map = HashMap::new();
6383 /// // You can also extend from another HashMap
6384 /// let mut new_map = HashMap::new();
6436 impl<'a, K, V, S, A> Extend<(&'a K, &'a V)> for HashMap<K, V, S, A>
6443 /// Inserts all new key-values from the iterator to existing `HashMap<K, V, S, A>`.
6452 /// use hashbrown::hash_map::HashMap;
6454 /// let mut map = HashMap::new();
6470 /// // You can also extend from another HashMap
6471 /// let mut new_map = HashMap::new();
6501 impl<'a, K, V, S, A> Extend<&'a (K, V)> for HashMap<K, V, S, A>
6508 /// Inserts all new key-values from the iterator to existing `HashMap<K, V, S, A>`.
6517 /// use hashbrown::hash_map::HashMap;
6519 /// let mut map = HashMap::new();
6561 fn map_key<'new>(v: HashMap<&'static str, u8>) -> HashMap<&'new str, u8> {
6564 fn map_val<'new>(v: HashMap<u8, &'static str>) -> HashMap<u8, &'new str> {
6607 use super::{HashMap, RawEntryMut};
6616 type HM = HashMap<i32, i32>;
6648 let mut m = HashMap::with_capacity(0);
6658 let mut m = HashMap::new();
6670 let mut m = HashMap::new();
6685 let mut m = HashMap::new();
6686 let mut m2 = HashMap::new();
6736 let mut m = HashMap::new();
6795 let mut hm = HashMap::new();
6852 let mut m: HashMap<i32, bool> = HashMap::new();
6858 let mut m: HashMap<i32, bool> = HashMap::new();
6869 let mut m: HashMap<std::string::String, bool> = HashMap::new();
6880 let mut m: HashMap<i32, bool> = HashMap::new();
6895 let mut m = HashMap::new();
6958 let mut m = HashMap::new();
6972 let mut m = HashMap::new();
6981 let mut m = HashMap::with_capacity(4);
6992 let mut m = HashMap::with_capacity(4);
7009 let mut map = HashMap::new();
7021 let mut m = HashMap::with_capacity(4);
7030 let mut m = HashMap::new();
7038 let mut m = HashMap::new();
7046 let mut m = HashMap::with_capacity(4);
7064 let map: HashMap<_, _> = vec.into_iter().collect();
7075 let map: HashMap<_, _> = vec.into_iter().collect();
7086 let mut map: HashMap<_, _> = vec.into_iter().collect();
7100 let map: HashMap<_, _> = vec.into_iter().collect();
7112 let map: HashMap<_, _> = vec.into_iter().collect();
7123 let mut m = HashMap::new();
7134 let mut m1 = HashMap::new();
7139 let mut m2 = HashMap::new();
7152 let mut map = HashMap::new();
7153 let empty: HashMap<i32, i32> = HashMap::new();
7166 let mut m = HashMap::new();
7184 let mut m = HashMap::new();
7240 let mut m = HashMap::new();
7279 let map: HashMap<_, _> = xs.iter().copied().collect();
7292 let map: HashMap<_, _> = xs.iter().copied().collect();
7305 let map: HashMap<_, _> = xs.iter().copied().collect();
7318 let mut map: HashMap<_, _> = xs.iter().copied().collect();
7331 let mut map: HashMap<_, _> = xs.iter().copied().collect();
7342 let mut map = HashMap::new();
7354 let mut map = HashMap::new();
7368 let mut map: HashMap<_, _> = xs.iter().copied().collect();
7425 let mut map: HashMap<_, _> = xs.iter().cloned().collect();
7475 fn check(m: &HashMap<i32, ()>) {
7481 let mut m = HashMap::new();
7511 fn check(m: &HashMap<std::string::String, ()>) {
7517 let mut m = HashMap::new();
7547 let mut a = HashMap::new();
7549 let mut b = HashMap::new();
7564 let mut a = HashMap::new();
7594 let mut a = HashMap::new();
7619 let mut a = HashMap::new();
7637 let mut a = HashMap::new();
7655 let mut a = HashMap::new();
7673 let mut a: HashMap<std::string::String, &str> = HashMap::new();
7691 let mut a = HashMap::new();
7734 let mut a: HashMap<std::string::String, &str> = HashMap::new();
7777 let mut a = HashMap::new();
7826 let mut a = HashMap::new();
7875 let mut a = HashMap::new();
7922 let mut a = HashMap::new();
7982 fn check(m: &HashMap<i32, ()>) {
7988 let mut m = HashMap::new();
8012 fn check(m: &HashMap<std::string::String, ()>) {
8018 let mut m = HashMap::new();
8042 let mut map: HashMap<i32, i32> = (0..100).map(|x| (x, x * 10)).collect();
8054 let mut map: HashMap<i32, i32> = (0..8).map(|x| (x, x * 10)).collect();
8062 let mut map: HashMap<i32, i32> = (0..8).map(|x| (x, x * 10)).collect();
8075 let mut empty_bytes: HashMap<u8, u8> = HashMap::new();
8086 let mut empty_bytes2: HashMap<u8, u8> = HashMap::new();
8088 let mut empty_bytes3: HashMap<u8, u8> = HashMap::new();
8090 let mut empty_bytes4: HashMap<u8, u8> = HashMap::new();
8104 let mut map: HashMap<_, _> = xs.iter().copied().collect();
8106 let compute_hash = |map: &HashMap<i32, i32>, k: i32| -> u64 {
8204 let mut m: HashMap<IntWrapper, (), ()> = HashMap::default();
8254 let mut map = HashMap::new();
8327 const EMPTY_MAP: HashMap<u32, std::string::String, MyHasher> =
8328 HashMap::with_hasher(MyHasher);
8337 let mut map = HashMap::new();
8394 let mut map1 = HashMap::new();
8400 let mut map2 = HashMap::new();