Lines Matching refs:keys
1360 let mut keys: Vec<_> = (0..n).map(|_| rng.gen::<usize>() % n).collect();
1362 for &k in &keys {
1366 keys.shuffle(&mut rng);
1371 let t = map.get(&keys[i]);
1582 // The returned map has small keys and values.
1583 // Benchmarks on it have a counterpart in set.rs with the same keys and no values at all.
1588 // The returned map has small keys and large values.
22294 /// significantly faster, as it does not recompute element keys.
29200 /// a `BTreeMap`, both iterators should produce keys in strictly ascending
29201 /// order, each greater than all keys in the tree, including any keys
29282 /// If two keys are equal, returns the key-value pair from the right source.
29297 /// as keys in a BTreeMap. The implementation intentionally uses does not rely
29726 let keys = node.keys();
29727 debug_assert!(start_index <= keys.len());
29728 for (offset, k) in unsafe { keys.get_unchecked(start_index..) }.iter().enumerate() {
29735 IndexResult::Edge(keys.len())
29886 /// // look up the values associated with some keys.
29905 /// methods of getting, setting, updating and removing keys and their values:
30133 /// An iterator over the keys of a `BTreeMap`.
30135 /// This `struct` is created by the [`keys`] method on [`BTreeMap`]. See its
30138 /// [`keys`]: BTreeMap::keys
30187 /// An owning iterator over the keys of a `BTreeMap`.
30601 /// [module-level documentation]: index.html#insert-and-complex-keys
30738 /// // Keep only the elements with even-numbered keys.
30992 /// Splitting a map into even and odd keys, reusing the original map:
31001 /// assert_eq!(evens.keys().copied().collect::<Vec<_>>(), vec![0, 2, 4, 6]);
31002 /// assert_eq!(odds.keys().copied().collect::<Vec<_>>(), vec![1, 3, 5, 7]);
31030 /// Creates a consuming iterator visiting all the keys, in sorted order.
31044 /// let keys: Vec<i32> = a.into_keys().collect();
31045 /// assert_eq!(keys, [1, 2]);
31895 /// Gets an iterator over the keys of the map, in sorted order.
31908 /// let keys: Vec<_> = a.keys().cloned().collect();
31909 /// assert_eq!(keys, [1, 2]);
31912 pub fn keys(&self) -> Keys<'_, K, V> {
32917 /// [module-level documentation]: index.html#insert-and-complex-keys
33175 Iter { iter: self.map.keys() }
34047 /// only to be called when all keys and values have been returned,
34048 /// no cleanup is done on any of the keys or values.
34190 /// Visits leaf nodes and internal KVs in order of ascending keys, and also
34982 // Which also means it returns different predetermined pseudo-random keys,
35625 // Check that `assert_strictly_ascending` will encounter all keys.
35626 assert_eq!(self.length, self.keys().count());
35629 // Panics if the map is corrupted or if the keys are not in strictly
35632 // guarantee that all keys are unique, just that adjacent keys are unique.
35657 // Panics if the keys are not in strictly ascending order.
35662 let mut keys = self.keys();
35663 if let Some(mut previous) = keys.next() {
35664 for next in keys {
35673 // been obtained by inserting keys in a shrewd order.
35817 assert_eq!(map.keys().count(), 0);
35835 assert_eq!(map.keys().collect::<Vec<_>>(), vec![&1]);
35843 assert_eq!(map.keys().collect::<Vec<_>>(), vec![&1]);
35855 assert_eq!(map.keys().collect::<Vec<_>>(), vec![&1, &2]);
35869 assert_eq!(map.keys().collect::<Vec<_>>(), vec![&2]);
35881 assert_eq!(map.keys().count(), 0);
36103 assert_eq!(a.keys().min(), None);
36104 assert_eq!(a.keys().max(), None);
36119 assert_eq!(a.keys().min(), Some(&1));
36120 assert_eq!(a.keys().max(), Some(&2));
36199 // close to the middle among the keys.
36521 assert!(map.keys().copied().eq(0..3));
36547 assert!(map.keys().copied().eq(0..3));
36568 assert!(map.keys().copied().eq(sacred..=sacred));
36587 assert!(map.keys().copied().eq(0..NODE_CAPACITY));
36608 assert!(map.keys().copied().eq(sacred..=sacred));
36656 assert!(map.keys().copied().eq(sacred..=sacred));
36678 assert!(map.keys().copied().eq(sacred..=sacred));
36936 // This test's only purpose is to ensure that zero-sized keys with nonsensical orderings
37197 fn keys<T: Sync>(v: &BTreeMap<T, T>) -> impl Sync + '_ {
37198 v.keys()
37266 fn keys<T: Send + Sync>(v: &BTreeMap<T, T>) -> impl Send + '_ {
37267 v.keys()
37313 map.keys();
37329 format!("{:?}", map.keys());
37528 map2.check(); // keys are not unique but still strictly ascending
37617 assert!(map.keys().copied().eq(small_keys));
37618 assert!(right.keys().copied().eq(large_keys));
37684 let keys: Vec<_> = map.into_keys().collect();
37686 assert_eq!(keys.len(), 3);
37687 assert!(keys.contains(&1));
37688 assert!(keys.contains(&2));
37689 assert!(keys.contains(&3));
37931 // keys: [K; 2 * B - 1],
37949 // - A node of length `n` has `n` keys, `n` values, and `n + 1` edges.
37980 /// The number of keys and values this node stores.
37985 keys: [MaybeUninit<K>; CAPACITY],
37995 // parent_idx, keys, and vals are all MaybeUninit
38012 /// behind `BoxedNode`s to prevent dropping uninitialized keys and values. Any pointer to an
38064 /// with respect to keys and tree structure, but also allows many
38075 /// - `K` and `V`: These are the types of keys and values stored in the nodes.
38191 /// Finds the length of the node. This is the number of keys or values.
38298 /// Borrows a view into the keys stored in the node.
38299 pub fn keys(&self) -> &[K] {
38302 MaybeUninit::slice_assume_init_ref(leaf.keys.get_unchecked(..usize::from(leaf.len)))
38373 unsafe { self.as_leaf_mut().keys.as_mut_slice().get_unchecked_mut(index) }
38415 let keys = unsafe { ptr::addr_of!((*leaf).keys) };
38418 let keys: *const [_] = keys;
38420 let key = unsafe { (&*keys.get_unchecked(idx)).assume_init_ref() };
38486 /// no cleanup is done on any of the keys, values and other children.
38738 /// the keys, values and edges to the left of the split point become the left child;
38739 /// the keys, values and edges to the right of the split point become the right child.
38927 let k = unsafe { leaf.keys.get_unchecked(self.idx).assume_init_ref() };
38958 let key = leaf.keys.get_unchecked_mut(self.idx).assume_init_mut();
38985 &mut new_node.keys[..new_len],
39648 // Renders a multi-line display of the keys in order and in tree hierarchy,
39660 result += &format!("\n{}{:?}", indent, leaf.keys());