| 1 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::{ |
| 2 | cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::{Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq#, Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#}, |
| 3 | hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/::{Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#, Hasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hasher#}, |
| 4 | iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::FromIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/FromIterator#, |
| 5 | 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#}, |
| 6 | }; |
| 7 | |
| 8 | use serde_deriverust-analyzer cargo serde_derive 1.0.228 crate/::{Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:}; |
| 9 | |
| 10 | use superrust-analyzer cargo ron 0.12.0 value/::Valuerust-analyzer cargo ron 0.12.0 value/Value#; |
| 11 | |
| 12 | /// A [`Value`] to [`Value`] map. |
| 13 | /// |
| 14 | /// This structure either uses a [`BTreeMap`](alloc::collections::BTreeMap) or the |
| 15 | /// [`IndexMap`](indexmap::IndexMap) internally. |
| 16 | /// The latter can be used by enabling the `indexmap` feature. This can be used |
| 17 | /// to preserve the order of the parsed map. |
| 18 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.228 Serialize:)] |
| 19 | #[serde(transparent)] |
| 20 | pub struct Maprust-analyzer cargo ron 0.12.0 value/map/Map#(pub(craterust-analyzer cargo ron 0.12.0 crate/) MapInnerrust-analyzer cargo ron 0.12.0 value/map/MapInner#); |
| 21 | |
| 22 | #[cfg(not(feature = "indexmap"))] |
| 23 | type MapInner = 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#<Valuerust-analyzer cargo ron 0.12.0 value/Value#, Valuerust-analyzer cargo ron 0.12.0 value/Value#>; |
| 24 | #[cfg(feature = "indexmap")] |
| 25 | type MapInnerrust-analyzer cargo ron 0.12.0 value/map/MapInner# = indexmaprust-analyzer cargo indexmap 2.5.0 crate/::IndexMaprust-analyzer cargo indexmap 2.5.0 map/IndexMap#<Valuerust-analyzer cargo ron 0.12.0 value/Value#, Valuerust-analyzer cargo ron 0.12.0 value/Value#, stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::hash_maprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash_map/::RandomStaterust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/random/RandomState#>; |
| 26 | |
| 27 | impl Maprust-analyzer cargo ron 0.12.0 value/map/Map# { |
| 28 | /// Creates a new, empty [`Map`]. |
| 29 | #[must_use] |
| 30 | pub fn newrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]new().() -> Selfrust-analyzer cargo ron 0.12.0 value/map/impl#[Map] { |
| 31 | Selfrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]::defaultrust-analyzer cargo ron 0.12.0 value/map/impl#[Map][Default]default().() |
| 32 | } |
| 33 | |
| 34 | /// Returns the number of elements in the map. |
| 35 | #[must_use] |
| 36 | pub fn lenrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]len().(&self) -> usize { |
| 37 | self.0rust-analyzer cargo ron 0.12.0 value/map/Map#0..lenrust-analyzer cargo indexmap 2.5.0 map/impl#[`IndexMap<K, V, S>`]len().() |
| 38 | } |
| 39 | |
| 40 | /// Returns `true` if `self.len() == 0`, `false` otherwise. |
| 41 | #[must_use] |
| 42 | pub fn is_emptyrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]is_empty().(&self) -> bool { |
| 43 | self.0rust-analyzer cargo ron 0.12.0 value/map/Map#0..is_emptyrust-analyzer cargo indexmap 2.5.0 map/impl#[`IndexMap<K, V, S>`]is_empty().() |
| 44 | } |
| 45 | |
| 46 | /// Immutably looks up an element by its `key`. |
| 47 | #[must_use] |
| 48 | pub fn getrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]get().(&self, key: &Valuerust-analyzer cargo ron 0.12.0 value/Value#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Valuerust-analyzer cargo ron 0.12.0 value/Value#> { |
| 49 | self.0rust-analyzer cargo ron 0.12.0 value/map/Map#0..getrust-analyzer cargo indexmap 2.5.0 map/impl#[`IndexMap<K, V, S>`]get().(key) |
| 50 | } |
| 51 | |
| 52 | /// Mutably looks up an element by its `key`. |
| 53 | pub fn get_mutrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]get_mut().(&mut self, key: &Valuerust-analyzer cargo ron 0.12.0 value/Value#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&mut Valuerust-analyzer cargo ron 0.12.0 value/Value#> { |
| 54 | self.0rust-analyzer cargo ron 0.12.0 value/map/Map#0..get_mutrust-analyzer cargo indexmap 2.5.0 map/impl#[`IndexMap<K, V, S>`]get_mut().(key) |
| 55 | } |
| 56 | |
| 57 | /// Inserts a new element, returning the previous element with this `key` if |
| 58 | /// there was any. |
| 59 | pub fn insertrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]insert().(&mut self, key: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Valuerust-analyzer cargo ron 0.12.0 value/Value#>, value: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Valuerust-analyzer cargo ron 0.12.0 value/Value#>) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Valuerust-analyzer cargo ron 0.12.0 value/Value#> { |
| 60 | self.0rust-analyzer cargo ron 0.12.0 value/map/Map#0..insertrust-analyzer cargo indexmap 2.5.0 map/impl#[`IndexMap<K, V, S>`]insert().(key.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(), value.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().()) |
| 61 | } |
| 62 | |
| 63 | /// Removes an element by its `key`. |
| 64 | pub fn removerust-analyzer cargo ron 0.12.0 value/map/impl#[Map]remove().(&mut self, key: &Valuerust-analyzer cargo ron 0.12.0 value/Value#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Valuerust-analyzer cargo ron 0.12.0 value/Value#> { |
| 65 | #[cfg(feature = "indexmap")] |
| 66 | { |
| 67 | self.0rust-analyzer cargo ron 0.12.0 value/map/Map#0..shift_removerust-analyzer cargo indexmap 2.5.0 map/impl#[`IndexMap<K, V, S>`]shift_remove().(key) |
| 68 | } |
| 69 | #[cfg(not(feature = "indexmap"))] |
| 70 | { |
| 71 | self.0.remove(key) |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | /// Iterate all key-value pairs. |
| 76 | #[must_use] |
| 77 | pub fn iterrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]iter().(&self) -> impl DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = (&Valuerust-analyzer cargo ron 0.12.0 value/Value#, &Valuerust-analyzer cargo ron 0.12.0 value/Value#)> { |
| 78 | self.0rust-analyzer cargo ron 0.12.0 value/map/Map#0..iterrust-analyzer cargo indexmap 2.5.0 map/impl#[`IndexMap<K, V, S>`]iter().() |
| 79 | } |
| 80 | |
| 81 | /// Iterate all key-value pairs mutably. |
| 82 | #[must_use] |
| 83 | pub fn iter_mutrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]iter_mut().(&mut self) -> impl DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = (&Valuerust-analyzer cargo ron 0.12.0 value/Value#, &mut Valuerust-analyzer cargo ron 0.12.0 value/Value#)> { |
| 84 | self.0rust-analyzer cargo ron 0.12.0 value/map/Map#0..iter_mutrust-analyzer cargo indexmap 2.5.0 map/impl#[`IndexMap<K, V, S>`]iter_mut().() |
| 85 | } |
| 86 | |
| 87 | /// Iterate all keys. |
| 88 | #[must_use] |
| 89 | pub fn keysrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]keys().(&self) -> impl DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = &Valuerust-analyzer cargo ron 0.12.0 value/Value#> { |
| 90 | self.0rust-analyzer cargo ron 0.12.0 value/map/Map#0..keysrust-analyzer cargo indexmap 2.5.0 map/impl#[`IndexMap<K, V, S>`]keys().() |
| 91 | } |
| 92 | |
| 93 | /// Iterate all values. |
| 94 | #[must_use] |
| 95 | pub fn valuesrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]values().(&self) -> impl DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = &Valuerust-analyzer cargo ron 0.12.0 value/Value#> { |
| 96 | self.0rust-analyzer cargo ron 0.12.0 value/map/Map#0..valuesrust-analyzer cargo indexmap 2.5.0 map/impl#[`IndexMap<K, V, S>`]values().() |
| 97 | } |
| 98 | |
| 99 | /// Iterate all values mutably. |
| 100 | #[must_use] |
| 101 | pub fn values_mutrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]values_mut().(&mut self) -> impl DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = &mut Valuerust-analyzer cargo ron 0.12.0 value/Value#> { |
| 102 | self.0rust-analyzer cargo ron 0.12.0 value/map/Map#0..values_mutrust-analyzer cargo indexmap 2.5.0 map/impl#[`IndexMap<K, V, S>`]values_mut().() |
| 103 | } |
| 104 | |
| 105 | /// Retains only the elements specified by the `keep` predicate. |
| 106 | /// |
| 107 | /// In other words, remove all pairs `(k, v)` for which `keep(&k, &mut v)` |
| 108 | /// returns `false`. |
| 109 | /// |
| 110 | /// The elements are visited in iteration order. |
| 111 | pub fn retainrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]retain().<F>(&mut self, keep: F) |
| 112 | where |
| 113 | F: FnMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnMut#(&Valuerust-analyzer cargo ron 0.12.0 value/Value#, &mut Valuerust-analyzer cargo ron 0.12.0 value/Value#) -> bool, |
| 114 | { |
| 115 | self.0rust-analyzer cargo ron 0.12.0 value/map/Map#0..retainrust-analyzer cargo indexmap 2.5.0 map/impl#[`IndexMap<K, V, S>`]retain().(keep); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | impl Indexrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#<&Valuerust-analyzer cargo ron 0.12.0 value/Value#> for Maprust-analyzer cargo ron 0.12.0 value/map/Map# { |
| 120 | type Outputrust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`Index<&Value>`]Output# = Valuerust-analyzer cargo ron 0.12.0 value/Value#; |
| 121 | |
| 122 | #[allow(clippy::expect_used)] |
| 123 | fn indexrust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`Index<&Value>`]index().(&self, index: &Valuerust-analyzer cargo ron 0.12.0 value/Value#) -> &Selfrust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`Index<&Value>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#Output# { |
| 124 | self.getrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]get().(index).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("no entry found for key") |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | impl IndexMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#<&Valuerust-analyzer cargo ron 0.12.0 value/Value#> for Maprust-analyzer cargo ron 0.12.0 value/map/Map# { |
| 129 | #[allow(clippy::expect_used)] |
| 130 | fn index_mutrust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`IndexMut<&Value>`]index_mut().(&mut self, index: &Valuerust-analyzer cargo ron 0.12.0 value/Value#) -> &mut Selfrust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`IndexMut<&Value>`]::Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#Output# { |
| 131 | self.get_mutrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]get_mut().(index).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("no entry found for key") |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | impl IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator# for Maprust-analyzer cargo ron 0.12.0 value/map/Map# { |
| 136 | type Itemrust-analyzer cargo ron 0.12.0 value/map/impl#[Map][IntoIterator]Item# = (Valuerust-analyzer cargo ron 0.12.0 value/Value#, Valuerust-analyzer cargo ron 0.12.0 value/Value#); |
| 137 | |
| 138 | type IntoIterrust-analyzer cargo ron 0.12.0 value/map/impl#[Map][IntoIterator]IntoIter# = <MapInnerrust-analyzer cargo ron 0.12.0 value/map/MapInner# as IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#>::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter#; |
| 139 | |
| 140 | fn into_iterrust-analyzer cargo ron 0.12.0 value/map/impl#[Map][IntoIterator]into_iter().(self) -> Selfrust-analyzer cargo ron 0.12.0 value/map/impl#[Map][IntoIterator]::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter# { |
| 141 | self.0rust-analyzer cargo ron 0.12.0 value/map/Map#0..into_iterrust-analyzer cargo indexmap 2.5.0 map/iter/impl#[`IndexMap<K, V, S>`][IntoIterator]into_iter().() |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | impl<K: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Valuerust-analyzer cargo ron 0.12.0 value/Value#>, V: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Valuerust-analyzer cargo ron 0.12.0 value/Value#>> FromIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/FromIterator#<(K, V)> for Maprust-analyzer cargo ron 0.12.0 value/map/Map# { |
| 146 | fn from_iterrust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`FromIterator<(K, V)>`]from_iter().<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)>>(iter: T) -> Selfrust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`FromIterator<(K, V)>`] { |
| 147 | Maprust-analyzer cargo ron 0.12.0 value/map/Map#(iter |
| 148 | .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().() |
| 149 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(key, value)| (key.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(), value.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().())) |
| 150 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()) |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | /// Note: equality is only given if both values and order of values match |
| 155 | impl PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# for Maprust-analyzer cargo ron 0.12.0 value/map/Map# { |
| 156 | fn eqrust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`PartialEq<Self>`]eq().(&self, other: &Maprust-analyzer cargo ron 0.12.0 value/map/Map#) -> bool { |
| 157 | self.cmprust-analyzer cargo ron 0.12.0 value/map/impl#[Map][Ord]cmp().(other).is_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impl#[Ordering]is_eq().() |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | /// Note: equality is only given if both values and order of values match |
| 162 | impl Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq# for Maprust-analyzer cargo ron 0.12.0 value/map/Map# {} |
| 163 | |
| 164 | impl PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd# for Maprust-analyzer cargo ron 0.12.0 value/map/Map# { |
| 165 | fn partial_cmprust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`PartialOrd<Self>`]partial_cmp().(&self, other: &Maprust-analyzer cargo ron 0.12.0 value/map/Map#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#> { |
| 166 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.cmprust-analyzer cargo ron 0.12.0 value/map/impl#[Map][Ord]cmp().(other)) |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | impl Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# for Maprust-analyzer cargo ron 0.12.0 value/map/Map# { |
| 171 | fn cmprust-analyzer cargo ron 0.12.0 value/map/impl#[Map][Ord]cmp().(&self, other: &Maprust-analyzer cargo ron 0.12.0 value/map/Map#) -> Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering# { |
| 172 | self.iterrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]iter().().cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cmp().(other.iterrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]iter().()) |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | impl Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash# for Maprust-analyzer cargo ron 0.12.0 value/map/Map# { |
| 177 | fn hashrust-analyzer cargo ron 0.12.0 value/map/impl#[Map][Hash]hash().<H: Hasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hasher#>(&self, state: &mut H) { |
| 178 | self.iterrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]iter().().for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(|x| x.hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/impls/impl#[`(T, B)`][Hash]hash().(state)); |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | #[cfg(test)] |
| 183 | mod testsrust-analyzer cargo ron 0.12.0 value/map/tests/ { |
| 184 | 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/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#}; |
| 185 | |
| 186 | use superrust-analyzer cargo ron 0.12.0 value/map/::{Maprust-analyzer cargo ron 0.12.0 value/map/Map#, Valuerust-analyzer cargo ron 0.12.0 value/Value#}; |
| 187 | |
| 188 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 189 | fn map_usagerust-analyzer cargo ron 0.12.0 value/map/tests/map_usage().() { |
| 190 | let mut map = Maprust-analyzer cargo ron 0.12.0 value/map/Map#::newrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]new().(); |
| 191 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]len().(), 0); |
| 192 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(map.is_emptyrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]is_empty().()); |
| 193 | |
| 194 | map.insertrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]insert().("a", 42); |
| 195 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]len().(), 1); |
| 196 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().map.is_emptyrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]is_empty().()); |
| 197 | |
| 198 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.keysrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]keys().().collectrust-analyzer cargo indexmap 2.5.0 map/iter/impl#[`Keys<'a, K, V>`][Iterator]collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("a")]); |
| 199 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.valuesrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]values().().collectrust-analyzer cargo indexmap 2.5.0 map/iter/impl#[`Values<'a, K, V>`][Iterator]collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(42)]); |
| 200 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 201 | map.iterrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]iter().().collectrust-analyzer cargo indexmap 2.5.0 map/iter/impl#[`Iter<'a, K, V>`][Iterator]collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), |
| 202 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("a"), &Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(42))] |
| 203 | ); |
| 204 | |
| 205 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.getrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]get().(&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("a")), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(42))); |
| 206 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.getrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]get().(&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("b")), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 207 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.get_mutrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]get_mut().(&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("a")), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(42))); |
| 208 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.get_mutrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]get_mut().(&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("b")), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 209 | |
| 210 | map[rust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`IndexMut<&Value>`]index_mut().&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("a")]rust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`IndexMut<&Value>`]index_mut(). = Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(24); |
| 211 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&map[rust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`Index<&Value>`]index().&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("a")]rust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`Index<&Value>`]index()., &Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(24)); |
| 212 | |
| 213 | for (key, value) in map.iter_mutrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]iter_mut().() { |
| 214 | if key rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("a") { |
| 215 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value = Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(42); |
| 216 | } |
| 217 | } |
| 218 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&map[rust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`Index<&Value>`]index().&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("a")]rust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`Index<&Value>`]index()., &Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(42)); |
| 219 | |
| 220 | map.values_mutrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]values_mut().().for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(|value| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value = Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(24)); |
| 221 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&map[rust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`Index<&Value>`]index().&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("a")]rust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`Index<&Value>`]index()., &Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(24)); |
| 222 | |
| 223 | map.insertrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]insert().("b", 42); |
| 224 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]len().(), 2); |
| 225 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().map.is_emptyrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]is_empty().()); |
| 226 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.getrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]get().(&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("a")), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(24))); |
| 227 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.getrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]get().(&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("b")), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(42))); |
| 228 | |
| 229 | map.retainrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]retain().(|key, value| { |
| 230 | if key rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("a") { |
| 231 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value = Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(42); |
| 232 | true |
| 233 | } else { |
| 234 | false |
| 235 | } |
| 236 | }); |
| 237 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]len().(), 1); |
| 238 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.getrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]get().(&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("a")), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(42))); |
| 239 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.getrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]get().(&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("b")), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 240 | |
| 241 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.removerust-analyzer cargo ron 0.12.0 value/map/impl#[Map]remove().(&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("b")), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 242 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.removerust-analyzer cargo ron 0.12.0 value/map/impl#[Map]remove().(&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("a")), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<T>`]from().(42))); |
| 243 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.removerust-analyzer cargo ron 0.12.0 value/map/impl#[Map]remove().(&Valuerust-analyzer cargo ron 0.12.0 value/Value#::fromrust-analyzer cargo ron 0.12.0 value/impl#[Value][`From<&'a str>`]from().("a")), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 244 | } |
| 245 | |
| 246 | #[cfg(feature = "std")] |
| 247 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 248 | fn map_hashrust-analyzer cargo ron 0.12.0 value/map/tests/map_hash().() { |
| 249 | assert_same_hashrust-analyzer cargo ron 0.12.0 value/map/tests/assert_same_hash().(&Maprust-analyzer cargo ron 0.12.0 value/map/Map#::newrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]new().(), &Maprust-analyzer cargo ron 0.12.0 value/map/Map#::newrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]new().()); |
| 250 | assert_same_hashrust-analyzer cargo ron 0.12.0 value/map/tests/assert_same_hash().( |
| 251 | &[("a", 42)].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().(), |
| 252 | &[("a", 42)].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().(), |
| 253 | ); |
| 254 | assert_same_hashrust-analyzer cargo ron 0.12.0 value/map/tests/assert_same_hash().( |
| 255 | &[("b", 24), ("c", 42)].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().(), |
| 256 | &[("b", 24), ("c", 42)].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().(), |
| 257 | ); |
| 258 | } |
| 259 | |
| 260 | #[cfg(feature = "std")] |
| 261 | fn assert_same_hashrust-analyzer cargo ron 0.12.0 value/map/tests/assert_same_hash().(a: &Maprust-analyzer cargo ron 0.12.0 value/map/Map#, b: &Maprust-analyzer cargo ron 0.12.0 value/map/Map#) { |
| 262 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/::{Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#, Hasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hasher#}; |
| 263 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::hash_maprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash_map/::DefaultHasherrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/random/DefaultHasher#; |
| 264 | |
| 265 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a, b); |
| 266 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(a.cmprust-analyzer cargo ron 0.12.0 value/map/impl#[Map][Ord]cmp().(b).is_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impl#[Ordering]is_eq().()); |
| 267 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a.partial_cmprust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`PartialOrd<Self>`]partial_cmp().(b), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#::Equalrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#Equal#)); |
| 268 | |
| 269 | let mut hasher = DefaultHasherrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/random/DefaultHasher#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/random/impl#[DefaultHasher]new().(); |
| 270 | a.hashrust-analyzer cargo ron 0.12.0 value/map/impl#[Map][Hash]hash().(&mut hasher); |
| 271 | let h1 = hasher.finishrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/random/impl#[DefaultHasher][Hasher]finish().(); |
| 272 | |
| 273 | let mut hasher = DefaultHasherrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/random/DefaultHasher#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/random/impl#[DefaultHasher]new().(); |
| 274 | b.hashrust-analyzer cargo ron 0.12.0 value/map/impl#[Map][Hash]hash().(&mut hasher); |
| 275 | let h2 = hasher.finishrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/random/impl#[DefaultHasher][Hasher]finish().(); |
| 276 | |
| 277 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(h1, h2); |
| 278 | } |
| 279 | |
| 280 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 281 | #[should_panic(expected = "no entry found for key")] |
| 282 | fn map_index_panicrust-analyzer cargo ron 0.12.0 value/map/tests/map_index_panic().() { |
| 283 | let _ = &Maprust-analyzer cargo ron 0.12.0 value/map/Map#::newrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]new().()[rust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`Index<&Value>`]index().&Valuerust-analyzer cargo ron 0.12.0 value/Value#::Unitrust-analyzer cargo ron 0.12.0 value/Value#Unit#]rust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`Index<&Value>`]index().; |
| 284 | } |
| 285 | |
| 286 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 287 | #[should_panic(expected = "no entry found for key")] |
| 288 | fn map_index_mut_panicrust-analyzer cargo ron 0.12.0 value/map/tests/map_index_mut_panic().() { |
| 289 | let _ = &mut Maprust-analyzer cargo ron 0.12.0 value/map/Map#::newrust-analyzer cargo ron 0.12.0 value/map/impl#[Map]new().()[rust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`IndexMut<&Value>`]index_mut().&Valuerust-analyzer cargo ron 0.12.0 value/Value#::Unitrust-analyzer cargo ron 0.12.0 value/Value#Unit#]rust-analyzer cargo ron 0.12.0 value/map/impl#[Map][`IndexMut<&Value>`]index_mut().; |
| 290 | } |
| 291 | } |