| 1 | //! An ordered map based on a B-Tree that keeps insertion order of elements. |
| 2 | |
| 3 | #[cfg(all( |
| 4 | feature = "hash-collections", |
| 5 | not(feature = "prefer-btree-collections") |
| 6 | ))] |
| 7 | mod implsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impls/ { |
| 8 | use craterust-analyzer cargo wasmparser 0.239.0 crate/::collectionsrust-analyzer cargo wasmparser 0.239.0 collections/::hashrust-analyzer cargo wasmparser 0.239.0 collections/hash/; |
| 9 | use indexmaprust-analyzer cargo indexmap 2.10.0 crate/::IndexMaprust-analyzer cargo indexmap 2.10.0 map/IndexMap#; |
| 10 | |
| 11 | pub type IndexMapImplrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impls/IndexMapImpl#<K, V> = IndexMaprust-analyzer cargo indexmap 2.10.0 map/IndexMap#<K, V, hashrust-analyzer cargo wasmparser 0.239.0 collections/hash/::RandomStaterust-analyzer cargo wasmparser 0.239.0 collections/hash/RandomState#>; |
| 12 | pub type EntryImplrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impls/EntryImpl#<'a, K, V> = indexmaprust-analyzer cargo indexmap 2.10.0 crate/::maprust-analyzer cargo indexmap 2.10.0 map/::Entryrust-analyzer cargo indexmap 2.10.0 map/core/entry/Entry#<'a, K, V>; |
| 13 | pub type OccupiedEntryImplrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impls/OccupiedEntryImpl#<'a, K, V> = indexmaprust-analyzer cargo indexmap 2.10.0 crate/::maprust-analyzer cargo indexmap 2.10.0 map/::OccupiedEntryrust-analyzer cargo indexmap 2.10.0 map/core/entry/OccupiedEntry#<'a, K, V>; |
| 14 | pub type VacantEntryImplrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impls/VacantEntryImpl#<'a, K, V> = indexmaprust-analyzer cargo indexmap 2.10.0 crate/::maprust-analyzer cargo indexmap 2.10.0 map/::VacantEntryrust-analyzer cargo indexmap 2.10.0 map/core/entry/VacantEntry#<'a, K, V>; |
| 15 | pub type IterImplrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impls/IterImpl#<'a, K, V> = indexmaprust-analyzer cargo indexmap 2.10.0 crate/::maprust-analyzer cargo indexmap 2.10.0 map/::Iterrust-analyzer cargo indexmap 2.10.0 map/iter/Iter#<'a, K, V>; |
| 16 | pub type IterMutImplrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impls/IterMutImpl#<'a, K, V> = indexmaprust-analyzer cargo indexmap 2.10.0 crate/::maprust-analyzer cargo indexmap 2.10.0 map/::IterMutrust-analyzer cargo indexmap 2.10.0 map/iter/IterMut#<'a, K, V>; |
| 17 | pub type IntoIterImplrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impls/IntoIterImpl#<K, V> = indexmaprust-analyzer cargo indexmap 2.10.0 crate/::maprust-analyzer cargo indexmap 2.10.0 map/::IntoIterrust-analyzer cargo indexmap 2.10.0 map/iter/IntoIter#<K, V>; |
| 18 | pub type KeysImplrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impls/KeysImpl#<'a, K, V> = indexmaprust-analyzer cargo indexmap 2.10.0 crate/::maprust-analyzer cargo indexmap 2.10.0 map/::Keysrust-analyzer cargo indexmap 2.10.0 map/iter/Keys#<'a, K, V>; |
| 19 | pub type ValuesImplrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impls/ValuesImpl#<'a, K, V> = indexmaprust-analyzer cargo indexmap 2.10.0 crate/::maprust-analyzer cargo indexmap 2.10.0 map/::Valuesrust-analyzer cargo indexmap 2.10.0 map/iter/Values#<'a, K, V>; |
| 20 | pub type ValuesMutImplrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impls/ValuesMutImpl#<'a, K, V> = indexmaprust-analyzer cargo indexmap 2.10.0 crate/::maprust-analyzer cargo indexmap 2.10.0 map/::ValuesMutrust-analyzer cargo indexmap 2.10.0 map/iter/ValuesMut#<'a, K, V>; |
| 21 | } |
| 22 | |
| 23 | #[cfg(any( |
| 24 | not(feature = "hash-collections"), |
| 25 | feature = "prefer-btree-collections" |
| 26 | ))] |
| 27 | mod implsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impls/ { |
| 28 | pub type IndexMapImpl<K, V> = superrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/::IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#<K, V>; |
| 29 | pub type EntryImpl<'a, K, V> = superrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/::Entryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#<'a, K, V>; |
| 30 | pub type OccupiedEntryImpl<'a, K, V> = superrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/::OccupiedEntryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry#<'a, K, V>; |
| 31 | pub type VacantEntryImpl<'a, K, V> = superrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/::VacantEntryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/VacantEntry#<'a, K, V>; |
| 32 | pub type IterImpl<'a, K, V> = superrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/::Iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Iter#<'a, K, V>; |
| 33 | pub type IterMutImpl<'a, K, V> = superrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/::IterMutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IterMut#<'a, K, V>; |
| 34 | pub type IntoIterImpl<K, V> = superrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/::IntoIterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IntoIter#<K, V>; |
| 35 | pub type KeysImpl<'a, K, V> = superrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/::Keysrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Keys#<'a, K, V>; |
| 36 | pub type ValuesImpl<'a, K, V> = superrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/::Valuesrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Values#<'a, K, V>; |
| 37 | pub type ValuesMutImpl<'a, K, V> = superrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/::ValuesMutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/ValuesMut#<'a, K, V>; |
| 38 | } |
| 39 | |
| 40 | pub use selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/::implsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impls/::*; |
| 41 | |
| 42 | use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::collectionsrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/::{BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#, btree_maprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree_map/}; |
| 43 | use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::IntoIterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/into_iter/IntoIter# as VecIntoIterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/into_iter/IntoIter#; |
| 44 | use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#; |
| 45 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/::Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#; |
| 46 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/; |
| 47 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator#; |
| 48 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::replacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/replace().; |
| 49 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::{Indexrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#, IndexMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#}; |
| 50 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/::Iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/Iter# as SliceIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/Iter#; |
| 51 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/::IterMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/IterMut# as SliceIterMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/IterMut#; |
| 52 | |
| 53 | /// A slot index referencing a slot in an [`IndexMap`]. |
| 54 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:)] |
| 55 | struct SlotIndexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/SlotIndex#(usize); |
| 56 | |
| 57 | impl SlotIndexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/SlotIndex# { |
| 58 | /// Returns the raw `usize` index of the [`SlotIndex`]. |
| 59 | pub fn indexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[SlotIndex]index().(self) -> usize { |
| 60 | self.0rust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/SlotIndex#0. |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:)] |
| 65 | struct Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#<K, V> { |
| 66 | /// The key of the [`Slot`]. |
| 67 | keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#key.: K, |
| 68 | /// The value of the [`Slot`]. |
| 69 | valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#value.: V, |
| 70 | } |
| 71 | |
| 72 | impl<K, V> Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#<K, V> { |
| 73 | /// Creates a new [`Slot`] from the given `key` and `value`. |
| 74 | pub fn newrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]new().(key: K, value: V) -> Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`] { |
| 75 | Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`] { keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#key., valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#value. } |
| 76 | } |
| 77 | |
| 78 | /// Returns the [`Slot`] as a pair of references to its `key` and `value`. |
| 79 | pub fn as_pairrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]as_pair().(&self) -> (&K, &V) { |
| 80 | (&self.keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#key., &self.valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#value.) |
| 81 | } |
| 82 | |
| 83 | /// Returns the [`Slot`] as a pair of references to its `key` and `value`. |
| 84 | pub fn as_pair_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]as_pair_mut().(&mut self) -> (&K, &mut V) { |
| 85 | (&self.keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#key., &mut self.valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#value.) |
| 86 | } |
| 87 | |
| 88 | /// Converts the [`Slot`] into a pair of its `key` and `value`. |
| 89 | pub fn into_pairrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]into_pair().(self) -> (K, V) { |
| 90 | (self.keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#key., self.valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#value.) |
| 91 | } |
| 92 | |
| 93 | /// Returns a shared reference to the key of the [`Slot`]. |
| 94 | pub fn keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]key().(&self) -> &K { |
| 95 | &self.keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#key. |
| 96 | } |
| 97 | |
| 98 | /// Returns a shared reference to the value of the [`Slot`]. |
| 99 | pub fn valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]value().(&self) -> &V { |
| 100 | &self.valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#value. |
| 101 | } |
| 102 | |
| 103 | /// Returns an exclusive reference to the value of the [`Slot`]. |
| 104 | pub fn value_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]value_mut().(&mut self) -> &mut V { |
| 105 | &mut self.valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#value. |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | /// A b-tree map where the iteration order of the key-value |
| 110 | /// pairs is independent of the ordering of the keys. |
| 111 | /// |
| 112 | /// The interface is closely compatible with the [`indexmap` crate] |
| 113 | /// and a subset of the features that is relevant for the |
| 114 | /// [`wasmparser-nostd` crate]. |
| 115 | /// |
| 116 | /// # Differences to original `IndexMap` |
| 117 | /// |
| 118 | /// Since the goal of this crate was to maintain a simple |
| 119 | /// `no_std` compatible fork of the [`indexmap` crate] there are some |
| 120 | /// downsides and differences. |
| 121 | /// |
| 122 | /// - Some operations such as `IndexMap::insert` now require `K: Clone`. |
| 123 | /// - It is to be expected that this fork performs worse than the original |
| 124 | /// [`indexmap` crate] implementation. |
| 125 | /// - The implementation is based on `BTreeMap` internally instead of |
| 126 | /// `HashMap` which has the effect that methods no longer require `K: Hash` |
| 127 | /// but `K: Ord` instead. |
| 128 | /// |
| 129 | /// [`indexmap` crate]: https://crates.io/crates/indexmap |
| 130 | /// [`wasmparser-nostd` crate]: https://crates.io/crates/wasmparser-nostd |
| 131 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:)] |
| 132 | pub struct IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#<K, V> { |
| 133 | /// A mapping from keys to slot indices. |
| 134 | key2slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#key2slot.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<K, SlotIndexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/SlotIndex#>, |
| 135 | /// A vector holding all slots of key value pairs. |
| 136 | slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#<K, V>>, |
| 137 | } |
| 138 | |
| 139 | impl<K, V> Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#<K, V> { |
| 140 | fn defaultrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][Default]default().() -> Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][Default] { |
| 141 | Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][Default]::newrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]new().() |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | impl<K, V> IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#<K, V> { |
| 146 | /// Makes a new, empty [`IndexMap`]. |
| 147 | /// |
| 148 | /// Does not allocate anything on its own. |
| 149 | pub fn newrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]new().() -> Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`] { |
| 150 | Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`] { |
| 151 | key2slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#key2slot.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().(), |
| 152 | slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(), |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | /// Constructs a new, empty [`IndexMap`] with at least the specified capacity. |
| 157 | /// |
| 158 | /// Does not allocate if `capacity` is zero. |
| 159 | pub fn with_capacityrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]with_capacity().(capacity: usize) -> Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`] { |
| 160 | Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`] { |
| 161 | key2slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#key2slot.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().(), |
| 162 | slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(capacity), |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | /// Reserve capacity for at least `additional` more key-value pairs. |
| 167 | pub fn reserverust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]reserve().(&mut self, additional: usize) { |
| 168 | self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots..reserverust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]reserve().(additional); |
| 169 | } |
| 170 | |
| 171 | /// Returns the number of elements in the map. |
| 172 | pub fn lenrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]len().(&self) -> usize { |
| 173 | self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() |
| 174 | } |
| 175 | |
| 176 | /// Returns `true` if the map contains no elements. |
| 177 | pub fn is_emptyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]is_empty().(&self) -> bool { |
| 178 | self.lenrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 |
| 179 | } |
| 180 | |
| 181 | /// Returns true if the map contains a value for the specified key. |
| 182 | /// |
| 183 | /// The key may be any borrowed form of the map’s key type, |
| 184 | /// but the ordering on the borrowed form must match the ordering on the key type. |
| 185 | pub fn contains_keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]contains_key().<Q: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#>(&self, key: &Q) -> bool |
| 186 | where |
| 187 | K: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Q> + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 188 | Q: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 189 | { |
| 190 | self.key2slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#key2slot..contains_keyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]contains_key().(key) |
| 191 | } |
| 192 | |
| 193 | /// Inserts a key-value pair into the map. |
| 194 | /// |
| 195 | /// If the map did not have this key present, `None` is returned. |
| 196 | /// |
| 197 | /// If the map did have this key present, the value is updated, and the old |
| 198 | /// value is returned. The key is not updated, though; this matters for |
| 199 | /// types that can be `==` without being identical. |
| 200 | pub fn insertrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]insert().(&mut self, key: K, value: V) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<V> |
| 201 | where |
| 202 | K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 203 | { |
| 204 | self.insert_fullrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]insert_full().(key, value).1 |
| 205 | } |
| 206 | |
| 207 | /// Inserts a key-value pair into the map. |
| 208 | /// |
| 209 | /// Returns the unique index to the key-value pair alongside the previous value. |
| 210 | /// |
| 211 | /// If the map did not have this key present, `None` is returned. |
| 212 | /// |
| 213 | /// If the map did have this key present, the value is updated, and the old |
| 214 | /// value is returned. The key is not updated, though; this matters for |
| 215 | /// types that can be `==` without being identical. |
| 216 | pub fn insert_fullrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]insert_full().(&mut self, key: K, value: V) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<V>) |
| 217 | where |
| 218 | K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 219 | { |
| 220 | match self.key2slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#key2slot..entryrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]entry().(key.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()) { |
| 221 | btree_maprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree_map/::Entryrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/Entry#::Vacantrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/Entry#Vacant#(entry) => { |
| 222 | let index = self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(); |
| 223 | entry.insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/impl#[`VacantEntry<'a, K, V, A>`]insert().(SlotIndexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/SlotIndex#(index)); |
| 224 | self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#::newrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]new().(key, value)); |
| 225 | (index, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) |
| 226 | } |
| 227 | btree_maprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree_map/::Entryrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/Entry#::Occupiedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/Entry#Occupied#(entry) => { |
| 228 | let index = entry.getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/impl#[`OccupiedEntry<'a, K, V, A>`]get().().indexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[SlotIndex]index().(); |
| 229 | let new_slot = Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#::newrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]new().(key, value); |
| 230 | let old_slot = replacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/replace().(&mut self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().index]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut()., new_slot); |
| 231 | (index, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(old_slot.valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#value.)) |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | /// Remove the key-value pair equivalent to `key` and return it and |
| 237 | /// the index it had. |
| 238 | /// |
| 239 | /// Like [`Vec::swap_remove`], the pair is removed by swapping it with the |
| 240 | /// last element of the map and popping it off. **This perturbs |
| 241 | /// the position of what used to be the last element!** |
| 242 | /// |
| 243 | /// Return `None` if `key` is not in map. |
| 244 | pub fn swap_removerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]swap_remove().<Q>(&mut self, key: &Q) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<V> |
| 245 | where |
| 246 | K: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Q> + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 247 | Q: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 248 | { |
| 249 | self.swap_remove_fullrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]swap_remove_full().(key) |
| 250 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(_index, _key, value)| value) |
| 251 | } |
| 252 | |
| 253 | /// Remove and return the key-value pair equivalent to `key`. |
| 254 | /// |
| 255 | /// Like [`Vec::swap_remove`], the pair is removed by swapping it with the |
| 256 | /// last element of the map and popping it off. **This perturbs |
| 257 | /// the position of what used to be the last element!** |
| 258 | /// |
| 259 | /// Return `None` if `key` is not in map. |
| 260 | /// |
| 261 | /// [`Vec::swap_remove`]: alloc::vec::Vec::swap_remove |
| 262 | pub fn swap_remove_entryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]swap_remove_entry().<Q>(&mut self, key: &Q) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(K, V)> |
| 263 | where |
| 264 | K: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Q> + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 265 | Q: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 266 | { |
| 267 | self.swap_remove_fullrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]swap_remove_full().(key) |
| 268 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(_index, key, value)| (key, value)) |
| 269 | } |
| 270 | |
| 271 | /// Remove the key-value pair equivalent to `key` and return it and |
| 272 | /// the index it had. |
| 273 | /// |
| 274 | /// Like [`Vec::swap_remove`], the pair is removed by swapping it with the |
| 275 | /// last element of the map and popping it off. **This perturbs |
| 276 | /// the position of what used to be the last element!** |
| 277 | /// |
| 278 | /// Return `None` if `key` is not in map. |
| 279 | pub fn swap_remove_fullrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]swap_remove_full().<Q>(&mut self, key: &Q) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(usize, K, V)> |
| 280 | where |
| 281 | K: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Q> + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 282 | Q: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 283 | { |
| 284 | let index = self.key2slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#key2slot..removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]remove().(key)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()..0rust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/SlotIndex#0.; |
| 285 | let removed = self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots..swap_removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]swap_remove().(index); |
| 286 | if index rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().self.lenrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]len().() { |
| 287 | // If the index was referring the last element |
| 288 | // `swap_remove` would not swap any other element |
| 289 | // thus adjustments are only needed if this was not the case. |
| 290 | let swapped = self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().index]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#key..borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().(); |
| 291 | let swapped_index = self |
| 292 | .key2slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#key2slot. |
| 293 | .get_mutrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get_mut().(swapped) |
| 294 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("the swapped entry's key must be present"); |
| 295 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().swapped_index = SlotIndexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/SlotIndex#(index); |
| 296 | } |
| 297 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((index, removed.keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#key., removed.valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#value.)) |
| 298 | } |
| 299 | |
| 300 | /// Gets the given key’s corresponding entry in the map for in-place manipulation. |
| 301 | pub fn entryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]entry().(&mut self, key: K) -> Entryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#<'_, K, V> |
| 302 | where |
| 303 | K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 304 | { |
| 305 | match self.key2slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#key2slot..entryrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]entry().(key) { |
| 306 | btree_maprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree_map/::Entryrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/Entry#::Vacantrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/Entry#Vacant#(entry) => Entryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#::Vacantrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Vacant#(VacantEntryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/VacantEntry# { |
| 307 | vacantrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/VacantEntry#vacant.: entry, |
| 308 | slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/VacantEntry#slots.: &mut self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots., |
| 309 | }), |
| 310 | btree_maprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree_map/::Entryrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/Entry#::Occupiedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/Entry#Occupied#(entry) => Entryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#::Occupiedrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Occupied#(OccupiedEntryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry# { |
| 311 | occupiedrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry#occupied.: entry, |
| 312 | slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry#slots.: &mut self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots., |
| 313 | }), |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | /// Returns a reference to the value corresponding to the key. |
| 318 | /// |
| 319 | /// The key may be any borrowed form of the map’s key type, |
| 320 | /// but the ordering on the borrowed form must match the ordering on the key type. |
| 321 | pub fn getrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]get().<Q>(&self, key: &Q) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&V> |
| 322 | where |
| 323 | K: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Q> + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 324 | Q: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 325 | { |
| 326 | self.key2slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#key2slot. |
| 327 | .getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().(key) |
| 328 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|slot| &self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().slot.indexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[SlotIndex]index().()]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#value.) |
| 329 | } |
| 330 | |
| 331 | /// Returns a mutable reference to the value corresponding to the key. |
| 332 | /// |
| 333 | /// The key may be any borrowed form of the map’s key type, |
| 334 | /// but the ordering on the borrowed form must match the ordering on the key type. |
| 335 | pub fn get_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]get_mut().<Q: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#>(&mut self, key: &Q) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&mut V> |
| 336 | where |
| 337 | K: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Q> + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 338 | Q: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 339 | { |
| 340 | self.key2slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#key2slot. |
| 341 | .getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().(key) |
| 342 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|slot| &mut self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().slot.indexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[SlotIndex]index().()]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut()..valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#value.) |
| 343 | } |
| 344 | |
| 345 | /// Returns the key-value pair corresponding to the supplied key. |
| 346 | /// |
| 347 | /// The supplied key may be any borrowed form of the map's key type, |
| 348 | /// but the ordering on the borrowed form *must* match the ordering |
| 349 | /// on the key type. |
| 350 | pub fn get_key_valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]get_key_value().<Q: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#>(&self, key: &Q) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(&K, &V)> |
| 351 | where |
| 352 | K: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Q> + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 353 | Q: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 354 | { |
| 355 | self.key2slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#key2slot. |
| 356 | .get_key_valuerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get_key_value().(key) |
| 357 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(key, slot)| (key, &self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().slot.indexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[SlotIndex]index().()]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#value.)) |
| 358 | } |
| 359 | |
| 360 | /// Returns the key-value pair corresponding to the supplied key |
| 361 | /// as well as the unique index of the returned key-value pair. |
| 362 | /// |
| 363 | /// The supplied key may be any borrowed form of the map's key type, |
| 364 | /// but the ordering on the borrowed form *must* match the ordering |
| 365 | /// on the key type. |
| 366 | pub fn get_fullrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]get_full().<Q: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#>(&self, key: &Q) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(usize, &K, &V)> |
| 367 | where |
| 368 | K: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Q> + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 369 | Q: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 370 | { |
| 371 | self.key2slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#key2slot..get_key_valuerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get_key_value().(key).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(key, slot)| { |
| 372 | let index = slot.indexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[SlotIndex]index().(); |
| 373 | let value = &self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().index]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#value.; |
| 374 | (index, key, value) |
| 375 | }) |
| 376 | } |
| 377 | |
| 378 | /// Returns the unique index corresponding to the supplied key. |
| 379 | /// |
| 380 | /// The supplied key may be any borrowed form of the map's key type, |
| 381 | /// but the ordering on the borrowed form *must* match the ordering |
| 382 | /// on the key type. |
| 383 | pub fn get_index_ofrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]get_index_of().<Q: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#>(&self, key: &Q) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize> |
| 384 | where |
| 385 | K: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Q> + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 386 | Q: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 387 | { |
| 388 | self.key2slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#key2slot..getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().(key).copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<&T>`]copied().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(SlotIndexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/SlotIndex#::indexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[SlotIndex]index().) |
| 389 | } |
| 390 | |
| 391 | /// Returns a shared reference to the key-value pair at the given index. |
| 392 | pub fn get_indexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]get_index().(&self, index: usize) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(&K, &V)> { |
| 393 | self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots..getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(index).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#::as_pairrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]as_pair().) |
| 394 | } |
| 395 | |
| 396 | /// Returns an exclusive reference to the key-value pair at the given index. |
| 397 | pub fn get_index_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]get_index_mut().(&mut self, index: usize) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(&K, &mut V)> { |
| 398 | self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots..get_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get_mut().(index).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#::as_pair_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]as_pair_mut().) |
| 399 | } |
| 400 | |
| 401 | /// Gets an iterator over the entries of the map, sorted by key. |
| 402 | pub fn iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]iter().(&self) -> Iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Iter#<'_, K, V> { |
| 403 | Iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Iter# { |
| 404 | iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Iter#iter.: self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().(), |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | /// Gets a mutable iterator over the entries of the map, sorted by key. |
| 409 | pub fn iter_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]iter_mut().(&mut self) -> IterMutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IterMut#<'_, K, V> { |
| 410 | IterMutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IterMut# { |
| 411 | iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IterMut#iter.: self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots..iter_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter_mut().(), |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | /// Gets an iterator over the values of the map, in order by key. |
| 416 | pub fn keysrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]keys().(&self) -> Keysrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Keys#<'_, K, V> { |
| 417 | Keysrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Keys# { |
| 418 | iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Keys#iter.: self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().(), |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | /// Gets an iterator over the values of the map, in order by key. |
| 423 | pub fn valuesrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]values().(&self) -> Valuesrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Values#<'_, K, V> { |
| 424 | Valuesrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Values# { |
| 425 | iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Values#iter.: self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().(), |
| 426 | } |
| 427 | } |
| 428 | |
| 429 | /// Gets a mutable iterator over the values of the map, in order by key. |
| 430 | pub fn values_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]values_mut().(&mut self) -> ValuesMutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/ValuesMut#<'_, K, V> { |
| 431 | ValuesMutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/ValuesMut# { |
| 432 | iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/ValuesMut#iter.: self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots..iter_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter_mut().(), |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | /// Clears the map, removing all elements. |
| 437 | pub fn clearrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]clear().(&mut self) { |
| 438 | self.key2slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#key2slot..clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]clear().(); |
| 439 | self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots..clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]clear().(); |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | impl<'a, K, Q, V> Indexrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#<&'a Q> for IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#<K, V> |
| 444 | where |
| 445 | K: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Q> + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 446 | Q: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 447 | { |
| 448 | type Outputrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][`Index<&'a Q>`]Output# = V; |
| 449 | |
| 450 | fn indexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][`Index<&'a Q>`]index().(&self, key: &'a Q) -> &Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][`Index<&'a Q>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#Output# { |
| 451 | self.getrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]get().(key).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("no entry found for key") |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | impl<K, V> Indexrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#<usize> for IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#<K, V> { |
| 456 | type Outputrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][`Index<usize>`]Output# = V; |
| 457 | |
| 458 | fn indexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][`Index<usize>`]index().(&self, index: usize) -> &Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][`Index<usize>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#Output# { |
| 459 | let (_key, value) = self |
| 460 | .get_indexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]get_index().(index) |
| 461 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("IndexMap: index out of bounds"); |
| 462 | value |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | impl<K, V> IndexMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#<usize> for IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#<K, V> { |
| 467 | fn index_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][`IndexMut<usize>`]index_mut().(&mut self, index: usize) -> &mut Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][`IndexMut<usize>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#Output# { |
| 468 | let (_key, value) = self |
| 469 | .get_index_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]get_index_mut().(index) |
| 470 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("IndexMap: index out of bounds"); |
| 471 | value |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | impl<'a, K, V> Extendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/Extend#<(&'a K, &'a V)> for IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#<K, V> |
| 476 | where |
| 477 | K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy#, |
| 478 | V: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy#, |
| 479 | { |
| 480 | fn extendrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][`Extend<(&'a K, &'a V)>`]extend().<T>(&mut self, iter: T) |
| 481 | where |
| 482 | T: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# = (&'a K, &'a V)>, |
| 483 | { |
| 484 | self.extendrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][`Extend<(K, V)>`]extend().(iter.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(key, value)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().key, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().value))) |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | impl<K, V> Extendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/Extend#<(K, V)> for IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#<K, V> |
| 489 | where |
| 490 | K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 491 | { |
| 492 | fn extendrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][`Extend<(K, V)>`]extend().<T>(&mut self, iter: T) |
| 493 | where |
| 494 | T: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# = (K, V)>, |
| 495 | { |
| 496 | iter.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().().for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(move |(k, v)| { |
| 497 | self.insertrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]insert().(k, v); |
| 498 | }); |
| 499 | } |
| 500 | } |
| 501 | |
| 502 | impl<K, V> FromIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/FromIterator#<(K, V)> for IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#<K, V> |
| 503 | where |
| 504 | K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 505 | { |
| 506 | fn from_iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][`FromIterator<(K, V)>`]from_iter().<T>(iter: T) -> Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][`FromIterator<(K, V)>`] |
| 507 | where |
| 508 | T: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# = (K, V)>, |
| 509 | { |
| 510 | let mut map = IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#::newrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]new().(); |
| 511 | map.extendrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][`Extend<(K, V)>`]extend().(iter); |
| 512 | map |
| 513 | } |
| 514 | } |
| 515 | |
| 516 | impl<K, V, const N: usize> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<[(K, V); N]> for IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#<K, V> |
| 517 | where |
| 518 | K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 519 | { |
| 520 | fn fromrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][`From<[(K, V); N]>`]from().(items: [(K, V); N]) -> Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][`From<[(K, V); N]>`] { |
| 521 | items.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 522 | } |
| 523 | } |
| 524 | |
| 525 | impl<'a, K, V> IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator# for &'a IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#<K, V> { |
| 526 | type Itemrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`&'a IndexMap<K, V>`][IntoIterator]Item# = (&'a K, &'a V); |
| 527 | type IntoIterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`&'a IndexMap<K, V>`][IntoIterator]IntoIter# = Iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Iter#<'a, K, V>; |
| 528 | |
| 529 | fn into_iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`&'a IndexMap<K, V>`][IntoIterator]into_iter().(self) -> Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`&'a IndexMap<K, V>`][IntoIterator]::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter# { |
| 530 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]iter().() |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | impl<'a, K, V> IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator# for &'a mut IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#<K, V> { |
| 535 | type Itemrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`&'a mut IndexMap<K, V>`][IntoIterator]Item# = (&'a K, &'a mut V); |
| 536 | type IntoIterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`&'a mut IndexMap<K, V>`][IntoIterator]IntoIter# = IterMutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IterMut#<'a, K, V>; |
| 537 | |
| 538 | fn into_iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`&'a mut IndexMap<K, V>`][IntoIterator]into_iter().(self) -> Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`&'a mut IndexMap<K, V>`][IntoIterator]::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter# { |
| 539 | self.iter_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]iter_mut().() |
| 540 | } |
| 541 | } |
| 542 | |
| 543 | impl<K, V> IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator# for IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#<K, V> { |
| 544 | type Itemrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][IntoIterator]Item# = (K, V); |
| 545 | type IntoIterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][IntoIterator]IntoIter# = IntoIterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IntoIter#<K, V>; |
| 546 | |
| 547 | fn into_iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][IntoIterator]into_iter().(self) -> Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`][IntoIterator]::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter# { |
| 548 | IntoIterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IntoIter# { |
| 549 | iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IntoIter#iter.: self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#slots..into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().(), |
| 550 | } |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | /// An iterator over the entries of an [`IndexMap`]. |
| 555 | /// |
| 556 | /// This `struct` is created by the [`iter`] method on [`IndexMap`]. See its |
| 557 | /// documentation for more. |
| 558 | /// |
| 559 | /// [`iter`]: IndexMap::iter |
| 560 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 561 | pub struct Iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Iter#<'a, K, V> { |
| 562 | iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Iter#iter.: SliceIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/Iter#<'a, Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#<K, V>>, |
| 563 | } |
| 564 | |
| 565 | impl<'a, K, V> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for Iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Iter#<'a, K, V> { |
| 566 | type Itemrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Iter<'a, K, V>`][Iterator]Item# = (&'a K, &'a V); |
| 567 | |
| 568 | fn size_hintrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Iter<'a, K, V>`][Iterator]size_hint().(&self) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) { |
| 569 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Iter#iter..size_hintrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]size_hint().() |
| 570 | } |
| 571 | |
| 572 | fn countrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Iter<'a, K, V>`][Iterator]count().(self) -> usize { |
| 573 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Iter#iter..countrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]count().() |
| 574 | } |
| 575 | |
| 576 | fn nextrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Iter<'a, K, V>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Iter<'a, K, V>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 577 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Iter#iter..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]next().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#::as_pairrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]as_pair().) |
| 578 | } |
| 579 | } |
| 580 | |
| 581 | impl<'a, K, V> DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator# for Iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Iter#<'a, K, V> { |
| 582 | fn next_backrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Iter<'a, K, V>`][DoubleEndedIterator]next_back().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Iter<'a, K, V>`][DoubleEndedIterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 583 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Iter#iter..next_backrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][DoubleEndedIterator]next_back().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#::as_pairrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]as_pair().) |
| 584 | } |
| 585 | } |
| 586 | |
| 587 | impl<'a, K, V> ExactSizeIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator# for Iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Iter#<'a, K, V> { |
| 588 | fn lenrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Iter<'a, K, V>`][ExactSizeIterator]len().(&self) -> usize { |
| 589 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Iter#iter..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'_, T>`][ExactSizeIterator]len().() |
| 590 | } |
| 591 | } |
| 592 | |
| 593 | impl<'a, K, V> FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator# for Iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Iter#<'a, K, V> {} |
| 594 | |
| 595 | /// A mutable iterator over the entries of an [`IndexMap`]. |
| 596 | /// |
| 597 | /// This `struct` is created by the [`iter_mut`] method on [`IndexMap`]. See its |
| 598 | /// documentation for more. |
| 599 | /// |
| 600 | /// [`iter_mut`]: IndexMap::iter_mut |
| 601 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 602 | pub struct IterMutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IterMut#<'a, K, V> { |
| 603 | iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IterMut#iter.: SliceIterMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/IterMut#<'a, Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#<K, V>>, |
| 604 | } |
| 605 | |
| 606 | impl<'a, K, V> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for IterMutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IterMut#<'a, K, V> { |
| 607 | type Itemrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IterMut<'a, K, V>`][Iterator]Item# = (&'a K, &'a mut V); |
| 608 | |
| 609 | fn size_hintrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IterMut<'a, K, V>`][Iterator]size_hint().(&self) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) { |
| 610 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IterMut#iter..size_hintrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`IterMut<'a, T>`][Iterator]size_hint().() |
| 611 | } |
| 612 | |
| 613 | fn countrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IterMut<'a, K, V>`][Iterator]count().(self) -> usize { |
| 614 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IterMut#iter..countrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`IterMut<'a, T>`][Iterator]count().() |
| 615 | } |
| 616 | |
| 617 | fn nextrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IterMut<'a, K, V>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IterMut<'a, K, V>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 618 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IterMut#iter..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`IterMut<'a, T>`][Iterator]next().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#::as_pair_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]as_pair_mut().) |
| 619 | } |
| 620 | } |
| 621 | |
| 622 | impl<'a, K, V> DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator# for IterMutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IterMut#<'a, K, V> { |
| 623 | fn next_backrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IterMut<'a, K, V>`][DoubleEndedIterator]next_back().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IterMut<'a, K, V>`][DoubleEndedIterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 624 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IterMut#iter..next_backrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`IterMut<'a, T>`][DoubleEndedIterator]next_back().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#::as_pair_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]as_pair_mut().) |
| 625 | } |
| 626 | } |
| 627 | |
| 628 | impl<'a, K, V> ExactSizeIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator# for IterMutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IterMut#<'a, K, V> { |
| 629 | fn lenrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IterMut<'a, K, V>`][ExactSizeIterator]len().(&self) -> usize { |
| 630 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IterMut#iter..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`IterMut<'_, T>`][ExactSizeIterator]len().() |
| 631 | } |
| 632 | } |
| 633 | |
| 634 | impl<'a, K, V> FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator# for IterMutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IterMut#<'a, K, V> {} |
| 635 | |
| 636 | /// An owning iterator over the entries of a [`IndexMap`]. |
| 637 | /// |
| 638 | /// This `struct` is created by the [`into_iter`] method on [`IndexMap`] |
| 639 | /// (provided by the [`IntoIterator`] trait). See its documentation for more. |
| 640 | /// |
| 641 | /// [`into_iter`]: IntoIterator::into_iter |
| 642 | /// [`IntoIterator`]: core::iter::IntoIterator |
| 643 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 644 | pub struct IntoIterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IntoIter#<K, V> { |
| 645 | iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IntoIter#iter.: VecIntoIterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/into_iter/IntoIter#<Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#<K, V>>, |
| 646 | } |
| 647 | |
| 648 | impl<K, V> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for IntoIterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IntoIter#<K, V> { |
| 649 | type Itemrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IntoIter<K, V>`][Iterator]Item# = (K, V); |
| 650 | |
| 651 | fn size_hintrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IntoIter<K, V>`][Iterator]size_hint().(&self) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) { |
| 652 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IntoIter#iter..size_hintrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/into_iter/impl#[`IntoIter<T, A>`][Iterator]size_hint().() |
| 653 | } |
| 654 | |
| 655 | fn countrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IntoIter<K, V>`][Iterator]count().(self) -> usize { |
| 656 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IntoIter#iter..countrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/into_iter/impl#[`IntoIter<T, A>`][Iterator]count().() |
| 657 | } |
| 658 | |
| 659 | fn nextrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IntoIter<K, V>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IntoIter<K, V>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 660 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IntoIter#iter..nextrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/into_iter/impl#[`IntoIter<T, A>`][Iterator]next().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#::into_pairrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]into_pair().) |
| 661 | } |
| 662 | } |
| 663 | |
| 664 | impl<K, V> DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator# for IntoIterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IntoIter#<K, V> { |
| 665 | fn next_backrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IntoIter<K, V>`][DoubleEndedIterator]next_back().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IntoIter<K, V>`][DoubleEndedIterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 666 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IntoIter#iter..next_backrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/into_iter/impl#[`IntoIter<T, A>`][DoubleEndedIterator]next_back().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#::into_pairrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]into_pair().) |
| 667 | } |
| 668 | } |
| 669 | |
| 670 | impl<K, V> ExactSizeIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator# for IntoIterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IntoIter#<K, V> { |
| 671 | fn lenrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IntoIter<K, V>`][ExactSizeIterator]len().(&self) -> usize { |
| 672 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IntoIter#iter..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator#len().() |
| 673 | } |
| 674 | } |
| 675 | |
| 676 | impl<K, V> FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator# for IntoIterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IntoIter#<K, V> {} |
| 677 | |
| 678 | /// An iterator over the keys of an [`IndexMap`]. |
| 679 | /// |
| 680 | /// This `struct` is created by the [`keys`] method on [`IndexMap`]. See its |
| 681 | /// documentation for more. |
| 682 | /// |
| 683 | /// [`keys`]: IndexMap::keys |
| 684 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 685 | pub struct Keysrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Keys#<'a, K, V> { |
| 686 | iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Keys#iter.: SliceIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/Iter#<'a, Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#<K, V>>, |
| 687 | } |
| 688 | |
| 689 | impl<'a, K, V> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for Keysrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Keys#<'a, K, V> { |
| 690 | type Itemrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Keys<'a, K, V>`][Iterator]Item# = &'a K; |
| 691 | |
| 692 | fn size_hintrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Keys<'a, K, V>`][Iterator]size_hint().(&self) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) { |
| 693 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Keys#iter..size_hintrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]size_hint().() |
| 694 | } |
| 695 | |
| 696 | fn countrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Keys<'a, K, V>`][Iterator]count().(self) -> usize { |
| 697 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Keys#iter..countrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]count().() |
| 698 | } |
| 699 | |
| 700 | fn nextrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Keys<'a, K, V>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Keys<'a, K, V>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 701 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Keys#iter..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]next().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#::keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]key().) |
| 702 | } |
| 703 | } |
| 704 | |
| 705 | impl<'a, K, V> DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator# for Keysrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Keys#<'a, K, V> { |
| 706 | fn next_backrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Keys<'a, K, V>`][DoubleEndedIterator]next_back().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Keys<'a, K, V>`][DoubleEndedIterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 707 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Keys#iter..next_backrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][DoubleEndedIterator]next_back().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#::keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]key().) |
| 708 | } |
| 709 | } |
| 710 | |
| 711 | impl<'a, K, V> ExactSizeIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator# for Keysrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Keys#<'a, K, V> { |
| 712 | fn lenrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Keys<'a, K, V>`][ExactSizeIterator]len().(&self) -> usize { |
| 713 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Keys#iter..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'_, T>`][ExactSizeIterator]len().() |
| 714 | } |
| 715 | } |
| 716 | |
| 717 | impl<'a, K, V> FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator# for Keysrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Keys#<'a, K, V> {} |
| 718 | |
| 719 | /// An iterator over the values of an [`IndexMap`]. |
| 720 | /// |
| 721 | /// This `struct` is created by the [`values`] method on [`IndexMap`]. See its |
| 722 | /// documentation for more. |
| 723 | /// |
| 724 | /// [`values`]: IndexMap::values |
| 725 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 726 | pub struct Valuesrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Values#<'a, K, V> { |
| 727 | iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Values#iter.: SliceIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/Iter#<'a, Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#<K, V>>, |
| 728 | } |
| 729 | |
| 730 | impl<'a, K, V> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for Valuesrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Values#<'a, K, V> { |
| 731 | type Itemrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Values<'a, K, V>`][Iterator]Item# = &'a V; |
| 732 | |
| 733 | fn size_hintrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Values<'a, K, V>`][Iterator]size_hint().(&self) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) { |
| 734 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Values#iter..size_hintrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]size_hint().() |
| 735 | } |
| 736 | |
| 737 | fn countrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Values<'a, K, V>`][Iterator]count().(self) -> usize { |
| 738 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Values#iter..countrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]count().() |
| 739 | } |
| 740 | |
| 741 | fn nextrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Values<'a, K, V>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Values<'a, K, V>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 742 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Values#iter..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]next().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#::valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]value().) |
| 743 | } |
| 744 | } |
| 745 | |
| 746 | impl<'a, K, V> DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator# for Valuesrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Values#<'a, K, V> { |
| 747 | fn next_backrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Values<'a, K, V>`][DoubleEndedIterator]next_back().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Values<'a, K, V>`][DoubleEndedIterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 748 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Values#iter..next_backrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][DoubleEndedIterator]next_back().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#::valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]value().) |
| 749 | } |
| 750 | } |
| 751 | |
| 752 | impl<'a, K, V> ExactSizeIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator# for Valuesrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Values#<'a, K, V> { |
| 753 | fn lenrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Values<'a, K, V>`][ExactSizeIterator]len().(&self) -> usize { |
| 754 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Values#iter..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'_, T>`][ExactSizeIterator]len().() |
| 755 | } |
| 756 | } |
| 757 | |
| 758 | impl<'a, K, V> FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator# for Valuesrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Values#<'a, K, V> {} |
| 759 | |
| 760 | /// An iterator over the values of an [`IndexMap`]. |
| 761 | /// |
| 762 | /// This `struct` is created by the [`values`] method on [`IndexMap`]. See its |
| 763 | /// documentation for more. |
| 764 | /// |
| 765 | /// [`values`]: IndexMap::values |
| 766 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 767 | pub struct ValuesMutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/ValuesMut#<'a, K, V> { |
| 768 | iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/ValuesMut#iter.: SliceIterMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/IterMut#<'a, Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#<K, V>>, |
| 769 | } |
| 770 | |
| 771 | impl<'a, K, V> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for ValuesMutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/ValuesMut#<'a, K, V> { |
| 772 | type Itemrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`ValuesMut<'a, K, V>`][Iterator]Item# = &'a mut V; |
| 773 | |
| 774 | fn size_hintrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`ValuesMut<'a, K, V>`][Iterator]size_hint().(&self) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) { |
| 775 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/ValuesMut#iter..size_hintrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`IterMut<'a, T>`][Iterator]size_hint().() |
| 776 | } |
| 777 | |
| 778 | fn countrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`ValuesMut<'a, K, V>`][Iterator]count().(self) -> usize { |
| 779 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/ValuesMut#iter..countrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`IterMut<'a, T>`][Iterator]count().() |
| 780 | } |
| 781 | |
| 782 | fn nextrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`ValuesMut<'a, K, V>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`ValuesMut<'a, K, V>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 783 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/ValuesMut#iter..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`IterMut<'a, T>`][Iterator]next().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#::value_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]value_mut().) |
| 784 | } |
| 785 | } |
| 786 | |
| 787 | impl<'a, K, V> DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator# for ValuesMutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/ValuesMut#<'a, K, V> { |
| 788 | fn next_backrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`ValuesMut<'a, K, V>`][DoubleEndedIterator]next_back().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`ValuesMut<'a, K, V>`][DoubleEndedIterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 789 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/ValuesMut#iter..next_backrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`IterMut<'a, T>`][DoubleEndedIterator]next_back().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#::value_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]value_mut().) |
| 790 | } |
| 791 | } |
| 792 | |
| 793 | impl<'a, K, V> ExactSizeIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator# for ValuesMutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/ValuesMut#<'a, K, V> { |
| 794 | fn lenrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`ValuesMut<'a, K, V>`][ExactSizeIterator]len().(&self) -> usize { |
| 795 | self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/ValuesMut#iter..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`IterMut<'_, T>`][ExactSizeIterator]len().() |
| 796 | } |
| 797 | } |
| 798 | |
| 799 | impl<'a, K, V> FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator# for ValuesMutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/ValuesMut#<'a, K, V> {} |
| 800 | |
| 801 | /// A view into a single entry in a map, which may either be vacant or occupied. |
| 802 | /// |
| 803 | /// This `enum` is constructed from the [`entry`] method on [`IndexMap`]. |
| 804 | /// |
| 805 | /// [`entry`]: IndexMap::entry |
| 806 | pub enum Entryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#<'a, K, V> { |
| 807 | /// A vacant entry. |
| 808 | Vacantrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Vacant#(VacantEntryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/VacantEntry#<'a, K, V>), |
| 809 | /// An occupied entry. |
| 810 | Occupiedrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Occupied#(OccupiedEntryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry#<'a, K, V>), |
| 811 | } |
| 812 | |
| 813 | impl<'a, K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, V> Entryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#<'a, K, V> { |
| 814 | /// Ensures a value is in the entry by inserting the default if empty, |
| 815 | /// and returns a mutable reference to the value in the entry. |
| 816 | pub fn or_insertrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]or_insert().(self, default: V) -> &'a mut V |
| 817 | where |
| 818 | K: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 819 | { |
| 820 | match self { |
| 821 | Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]::Occupiedrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Occupied#(entry) => entry.into_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`OccupiedEntry<'a, K, V>`]into_mut().(), |
| 822 | Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]::Vacantrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Vacant#(entry) => entry.insertrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`VacantEntry<'a, K, V>`]insert().(default), |
| 823 | } |
| 824 | } |
| 825 | |
| 826 | /// Ensures a value is in the entry by inserting the result |
| 827 | /// of the default function if empty, |
| 828 | /// and returns a mutable reference to the value in the entry. |
| 829 | pub fn or_insert_withrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]or_insert_with().<F: FnOncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnOnce#() -> V>(self, default: F) -> &'a mut V |
| 830 | where |
| 831 | K: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 832 | { |
| 833 | match self { |
| 834 | Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]::Occupiedrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Occupied#(entry) => entry.into_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`OccupiedEntry<'a, K, V>`]into_mut().(), |
| 835 | Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]::Vacantrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Vacant#(entry) => entry.insertrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`VacantEntry<'a, K, V>`]insert().(default()), |
| 836 | } |
| 837 | } |
| 838 | |
| 839 | /// Ensures a value is in the entry by inserting, |
| 840 | /// if empty, the result of the default function. |
| 841 | /// |
| 842 | /// This method allows for generating key-derived values for |
| 843 | /// insertion by providing the default function a reference |
| 844 | /// to the key that was moved during the `.entry(key)` method call. |
| 845 | /// |
| 846 | /// The reference to the moved key is provided |
| 847 | /// so that cloning or copying the key is |
| 848 | /// unnecessary, unlike with `.or_insert_with(|| ... )`. |
| 849 | pub fn or_insert_with_keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]or_insert_with_key().<F: FnOncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnOnce#(&K) -> V>(self, default: F) -> &'a mut V |
| 850 | where |
| 851 | K: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 852 | { |
| 853 | match self { |
| 854 | Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]::Occupiedrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Occupied#(entry) => entry.into_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`OccupiedEntry<'a, K, V>`]into_mut().(), |
| 855 | Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]::Vacantrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Vacant#(entry) => { |
| 856 | let value = default(entry.keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`VacantEntry<'a, K, V>`]key().()); |
| 857 | entry.insertrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`VacantEntry<'a, K, V>`]insert().(value) |
| 858 | } |
| 859 | } |
| 860 | } |
| 861 | |
| 862 | /// Returns a reference to this entry’s key. |
| 863 | pub fn keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]key().(&self) -> &K { |
| 864 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 865 | Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]::Occupiedrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Occupied#(ref entry) => entry.keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`OccupiedEntry<'a, K, V>`]key().(), |
| 866 | Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]::Vacantrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Vacant#(ref entry) => entry.keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`VacantEntry<'a, K, V>`]key().(), |
| 867 | } |
| 868 | } |
| 869 | |
| 870 | /// Provides in-place mutable access to an occupied entry |
| 871 | /// before any potential inserts into the map. |
| 872 | pub fn and_modifyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]and_modify().<F>(self, f: F) -> Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`] |
| 873 | where |
| 874 | F: FnOncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnOnce#(&mut V), |
| 875 | { |
| 876 | match self { |
| 877 | Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]::Occupiedrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Occupied#(mut entry) => { |
| 878 | f(entry.get_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`OccupiedEntry<'a, K, V>`]get_mut().()); |
| 879 | Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]::Occupiedrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Occupied#(entry) |
| 880 | } |
| 881 | Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]::Vacantrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Vacant#(entry) => Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]::Vacantrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Vacant#(entry), |
| 882 | } |
| 883 | } |
| 884 | } |
| 885 | |
| 886 | impl<'a, K, V> Entryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#<'a, K, V> |
| 887 | where |
| 888 | K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 889 | V: Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#, |
| 890 | { |
| 891 | /// Ensures a value is in the entry by inserting the default value if empty, |
| 892 | /// and returns a mutable reference to the value in the entry. |
| 893 | pub fn or_defaultrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]or_default().(self) -> &'a mut V { |
| 894 | match self { |
| 895 | Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]::Occupiedrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Occupied#(entry) => entry.into_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`OccupiedEntry<'a, K, V>`]into_mut().(), |
| 896 | Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`]::Vacantrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Vacant#(entry) => entry.insertrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`VacantEntry<'a, K, V>`]insert().(Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#default().()), |
| 897 | } |
| 898 | } |
| 899 | } |
| 900 | |
| 901 | impl<'a, K, V> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for Entryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#<'a, K, V> |
| 902 | where |
| 903 | K: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 904 | V: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, |
| 905 | { |
| 906 | fn fmtrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Entry<'a, K, V>`][Debug]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 907 | match self { |
| 908 | Entryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#::Vacantrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Vacant#(entry) => entry.fmtrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`VacantEntry<'a, K, V>`][Debug]fmt().(f), |
| 909 | Entryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#::Occupiedrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Entry#Occupied#(entry) => entry.fmtrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`OccupiedEntry<'a, K, V>`][Debug]fmt().(f), |
| 910 | } |
| 911 | } |
| 912 | } |
| 913 | |
| 914 | /// A view into a vacant entry in an [`IndexMap`]. It is part of the [`Entry`] `enum`. |
| 915 | pub struct VacantEntryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/VacantEntry#<'a, K, V> { |
| 916 | /// The underlying vacant entry. |
| 917 | vacantrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/VacantEntry#vacant.: btree_maprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree_map/::VacantEntryrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/VacantEntry#<'a, K, SlotIndexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/SlotIndex#>, |
| 918 | /// The vector that stores all slots. |
| 919 | slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/VacantEntry#slots.: &'a mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#<K, V>>, |
| 920 | } |
| 921 | |
| 922 | impl<'a, K, V> VacantEntryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/VacantEntry#<'a, K, V> |
| 923 | where |
| 924 | K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 925 | { |
| 926 | /// Gets a reference to the key that would be used when inserting a value through the VacantEntry. |
| 927 | pub fn keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`VacantEntry<'a, K, V>`]key().(&self) -> &K { |
| 928 | self.vacantrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/VacantEntry#vacant..keyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/impl#[`VacantEntry<'a, K, V, A>`]key().() |
| 929 | } |
| 930 | |
| 931 | /// Take ownership of the key. |
| 932 | pub fn into_keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`VacantEntry<'a, K, V>`]into_key().(self) -> K { |
| 933 | self.vacantrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/VacantEntry#vacant..into_keyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/impl#[`VacantEntry<'a, K, V, A>`]into_key().() |
| 934 | } |
| 935 | |
| 936 | /// Sets the value of the entry with the `VacantEntry`’s key, |
| 937 | /// and returns a mutable reference to it. |
| 938 | pub fn insertrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`VacantEntry<'a, K, V>`]insert().(self, value: V) -> &'a mut V |
| 939 | where |
| 940 | K: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 941 | { |
| 942 | let index = self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/VacantEntry#slots..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(); |
| 943 | let key = self.vacantrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/VacantEntry#vacant..keyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/impl#[`VacantEntry<'a, K, V, A>`]key().().clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(); |
| 944 | self.vacantrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/VacantEntry#vacant..insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/impl#[`VacantEntry<'a, K, V, A>`]insert().(SlotIndexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/SlotIndex#(index)); |
| 945 | self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/VacantEntry#slots..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#::newrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]new().(key, value)); |
| 946 | &mut self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/VacantEntry#slots.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().index]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut()..valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#value. |
| 947 | } |
| 948 | } |
| 949 | |
| 950 | impl<'a, K, V> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for VacantEntryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/VacantEntry#<'a, K, V> |
| 951 | where |
| 952 | K: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 953 | { |
| 954 | fn fmtrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`VacantEntry<'a, K, V>`][Debug]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 955 | f.debug_structrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]debug_struct().("VacantEntry") |
| 956 | .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]field().("key", self.keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`VacantEntry<'a, K, V>`]key().()) |
| 957 | .finishrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]finish().() |
| 958 | } |
| 959 | } |
| 960 | |
| 961 | /// A view into an occupied entry in a [`IndexMap`]. It is part of the [`Entry`] `enum`. |
| 962 | pub struct OccupiedEntryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry#<'a, K, V> { |
| 963 | /// The underlying occupied entry. |
| 964 | occupiedrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry#occupied.: btree_maprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree_map/::OccupiedEntryrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/OccupiedEntry#<'a, K, SlotIndexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/SlotIndex#>, |
| 965 | /// The vector that stores all slots. |
| 966 | slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry#slots.: &'a mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#<K, V>>, |
| 967 | } |
| 968 | |
| 969 | impl<'a, K, V> OccupiedEntryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry#<'a, K, V> |
| 970 | where |
| 971 | K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 972 | { |
| 973 | /// Gets a reference to the key in the entry. |
| 974 | pub fn keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`OccupiedEntry<'a, K, V>`]key().(&self) -> &K { |
| 975 | self.occupiedrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry#occupied..keyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/impl#[`OccupiedEntry<'a, K, V, A>`]key().() |
| 976 | } |
| 977 | |
| 978 | /// Gets a reference to the value in the entry. |
| 979 | pub fn getrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`OccupiedEntry<'a, K, V>`]get().(&self) -> &V { |
| 980 | let index = self.occupiedrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry#occupied..getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/impl#[`OccupiedEntry<'a, K, V, A>`]get().().indexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[SlotIndex]index().(); |
| 981 | &self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry#slots.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().index]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#value. |
| 982 | } |
| 983 | |
| 984 | /// Gets a mutable reference to the value in the entry. |
| 985 | /// |
| 986 | /// If you need a reference to the `OccupiedEntry` that may outlive the |
| 987 | /// destruction of the `Entry` value, see [`into_mut`]. |
| 988 | /// |
| 989 | /// [`into_mut`]: OccupiedEntry::into_mut |
| 990 | pub fn get_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`OccupiedEntry<'a, K, V>`]get_mut().(&mut self) -> &mut V { |
| 991 | let index = self.occupiedrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry#occupied..getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/impl#[`OccupiedEntry<'a, K, V, A>`]get().().indexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[SlotIndex]index().(); |
| 992 | &mut self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry#slots.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().index]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut()..valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#value. |
| 993 | } |
| 994 | |
| 995 | /// Converts the entry into a mutable reference to its value. |
| 996 | /// |
| 997 | /// If you need multiple references to the `OccupiedEntry`, see [`get_mut`]. |
| 998 | /// |
| 999 | /// [`get_mut`]: OccupiedEntry::get_mut |
| 1000 | pub fn into_mutrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`OccupiedEntry<'a, K, V>`]into_mut().(self) -> &'a mut V { |
| 1001 | let index = self.occupiedrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry#occupied..getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/impl#[`OccupiedEntry<'a, K, V, A>`]get().().indexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[SlotIndex]index().(); |
| 1002 | &mut self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry#slots.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().index]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut()..valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#value. |
| 1003 | } |
| 1004 | |
| 1005 | /// Sets the value of the entry with the `OccupiedEntry`’s key, |
| 1006 | /// and returns the entry’s old value. |
| 1007 | pub fn insertrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`OccupiedEntry<'a, K, V>`]insert().(&mut self, value: V) -> V |
| 1008 | where |
| 1009 | K: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 1010 | { |
| 1011 | let index = self.occupiedrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry#occupied..getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/entry/impl#[`OccupiedEntry<'a, K, V, A>`]get().().indexrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[SlotIndex]index().(); |
| 1012 | let key = self.keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`OccupiedEntry<'a, K, V>`]key().().clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(); |
| 1013 | let new_slot = Slotrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#::newrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`Slot<K, V>`]new().(key, value); |
| 1014 | let old_slot = replacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/replace().(&mut self.slotsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry#slots.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().index]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut()., new_slot); |
| 1015 | old_slot.valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/Slot#value. |
| 1016 | } |
| 1017 | } |
| 1018 | |
| 1019 | impl<'a, K, V> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for OccupiedEntryrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/OccupiedEntry#<'a, K, V> |
| 1020 | where |
| 1021 | K: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 1022 | V: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, |
| 1023 | { |
| 1024 | fn fmtrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`OccupiedEntry<'a, K, V>`][Debug]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 1025 | f.debug_structrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]debug_struct().("OccupiedEntry") |
| 1026 | .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]field().("key", self.keyrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`OccupiedEntry<'a, K, V>`]key().()) |
| 1027 | .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]field().("value", self.getrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`OccupiedEntry<'a, K, V>`]get().()) |
| 1028 | .finishrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]finish().() |
| 1029 | } |
| 1030 | } |
| 1031 | |
| 1032 | #[cfg(feature = "serde")] |
| 1033 | mod serde_implsrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/serde_impls/ { |
| 1034 | use superrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/::IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#; |
| 1035 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/; |
| 1036 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#; |
| 1037 | use serderust-analyzer cargo serde 1.0.219 crate/::derust-analyzer cargo serde 1.0.219 de/::{Deserializerust-analyzer cargo serde 1.0.219 de/Deserialize#, MapAccessrust-analyzer cargo serde 1.0.219 de/MapAccess#, Visitorrust-analyzer cargo serde 1.0.219 de/Visitor#}; |
| 1038 | use serderust-analyzer cargo serde 1.0.219 crate/::serrust-analyzer cargo serde 1.0.219 ser/::{Serializerust-analyzer cargo serde 1.0.219 ser/Serialize#, SerializeMaprust-analyzer cargo serde 1.0.219 ser/SerializeMap#, Serializerrust-analyzer cargo serde 1.0.219 ser/Serializer#}; |
| 1039 | |
| 1040 | impl<K, V> Serializerust-analyzer cargo serde 1.0.219 ser/Serialize# for IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#<K, V> |
| 1041 | where |
| 1042 | K: Serializerust-analyzer cargo serde 1.0.219 ser/Serialize# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 1043 | V: Serializerust-analyzer cargo serde 1.0.219 ser/Serialize#, |
| 1044 | { |
| 1045 | fn serializerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/serde_impls/impl#[`IndexMap<K, V>`][Serialize]serialize().<S>(&self, serializer: S) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<S::Okrust-analyzer cargo serde 1.0.219 ser/Serializer#Ok#, S::Errorrust-analyzer cargo serde 1.0.219 ser/Serializer#Error#> |
| 1046 | where |
| 1047 | S: Serializerrust-analyzer cargo serde 1.0.219 ser/Serializer#, |
| 1048 | { |
| 1049 | let mut map = serializer.serialize_maprust-analyzer cargo serde 1.0.219 ser/Serializer#serialize_map().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.lenrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]len().()))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1050 | for (k, v) in self.iterrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]iter().() { |
| 1051 | map.serialize_entryrust-analyzer cargo serde 1.0.219 ser/SerializeMap#serialize_entry().(k, v)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 1052 | } |
| 1053 | map.endrust-analyzer cargo serde 1.0.219 ser/SerializeMap#end().() |
| 1054 | } |
| 1055 | } |
| 1056 | |
| 1057 | impl<'a, K, V> Deserializerust-analyzer cargo serde 1.0.219 de/Deserialize#<'a> for IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#<K, V> |
| 1058 | where |
| 1059 | K: Deserializerust-analyzer cargo serde 1.0.219 de/Deserialize#<'a> + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 1060 | V: Deserializerust-analyzer cargo serde 1.0.219 de/Deserialize#<'a>, |
| 1061 | { |
| 1062 | fn deserializerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/serde_impls/impl#[`IndexMap<K, V>`][`Deserialize<'a>`]deserialize().<D>(deserializer: D) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/serde_impls/impl#[`IndexMap<K, V>`][`Deserialize<'a>`], D::Errorrust-analyzer cargo serde 1.0.219 de/Deserializer#Error#> |
| 1063 | where |
| 1064 | D: serderust-analyzer cargo serde 1.0.219 crate/::derust-analyzer cargo serde 1.0.219 de/::Deserializerrust-analyzer cargo serde 1.0.219 de/Deserializer#<'a>, |
| 1065 | { |
| 1066 | deserializer.deserialize_maprust-analyzer cargo serde 1.0.219 de/Deserializer#deserialize_map().(IndexMapVisitorrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/serde_impls/IndexMapVisitor# { |
| 1067 | _markerrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/serde_impls/IndexMapVisitor#_marker.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 1068 | }) |
| 1069 | } |
| 1070 | } |
| 1071 | |
| 1072 | struct IndexMapVisitorrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/serde_impls/IndexMapVisitor#<K, V> { |
| 1073 | _markerrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/serde_impls/IndexMapVisitor#_marker.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<fn() -> IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#<K, V>>, |
| 1074 | } |
| 1075 | |
| 1076 | impl<'de, K, V> Visitorrust-analyzer cargo serde 1.0.219 de/Visitor#<'de> for IndexMapVisitorrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/serde_impls/IndexMapVisitor#<K, V> |
| 1077 | where |
| 1078 | K: Deserializerust-analyzer cargo serde 1.0.219 de/Deserialize#<'de> + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 1079 | V: Deserializerust-analyzer cargo serde 1.0.219 de/Deserialize#<'de>, |
| 1080 | { |
| 1081 | type Valuerust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/serde_impls/impl#[`IndexMapVisitor<K, V>`][`Visitor<'de>`]Value# = IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#<K, V>; |
| 1082 | |
| 1083 | fn expectingrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/serde_impls/impl#[`IndexMapVisitor<K, V>`][`Visitor<'de>`]expecting().(&self, formatter: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 1084 | formatter.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("a map") |
| 1085 | } |
| 1086 | |
| 1087 | fn visit_maprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/serde_impls/impl#[`IndexMapVisitor<K, V>`][`Visitor<'de>`]visit_map().<M>(self, mut access: M) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/serde_impls/impl#[`IndexMapVisitor<K, V>`][`Visitor<'de>`]::Valuerust-analyzer cargo serde 1.0.219 de/Visitor#Value#, M::Errorrust-analyzer cargo serde 1.0.219 de/MapAccess#Error#> |
| 1088 | where |
| 1089 | M: MapAccessrust-analyzer cargo serde 1.0.219 de/MapAccess#<'de>, |
| 1090 | { |
| 1091 | let mut map = IndexMaprust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/IndexMap#::with_capacityrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]with_capacity().(access.size_hintrust-analyzer cargo serde 1.0.219 de/MapAccess#size_hint().().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(0)); |
| 1092 | |
| 1093 | while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((key, value)) = access.next_entryrust-analyzer cargo serde 1.0.219 de/MapAccess#next_entry().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). { |
| 1094 | map.insertrust-analyzer cargo wasmparser 0.239.0 collections/index_map/detail/impl#[`IndexMap<K, V>`]insert().(key, value); |
| 1095 | } |
| 1096 | |
| 1097 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(map) |
| 1098 | } |
| 1099 | } |
| 1100 | } |