Debian Codegraph @

src/map/tests.rs

raw symbols SCIP
1 use superrust-analyzer cargo ordermap 1.2.0 map/::*;
2 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/::Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#;
3 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std 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#;
4
5 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
6 fn it_worksrust-analyzer cargo ordermap 1.2.0 map/tests/it_works().() {
7 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
8 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.is_emptyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]is_empty().(), true);
9 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, ());
10 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, ());
11 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), 1);
12 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(map.getrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get().(&1).is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().());
13 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.is_emptyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]is_empty().(), false);
14 }
15
16 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
17 fn newrust-analyzer cargo ordermap 1.2.0 map/tests/new().() {
18 let map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
19 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?}", map);
20 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.capacityrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]capacity().(), 0);
21 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), 0);
22 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.is_emptyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]is_empty().(), true);
23 }
24
25 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
26 fn insertrust-analyzer cargo ordermap 1.2.0 map/tests/insert().() {
27 let insert = [0, 4, 2, 12, 8, 7, 11, 5];
28 let not_present = [1, 3, 6, 9, 10];
29 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::with_capacityrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]with_capacity().(insert.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().());
30
31 for (i, &elt) in insert.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() {
32 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), i);
33 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(elt, elt);
34 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), i +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1);
35 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.getrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get().(&elt), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&elt));
36 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map[rust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`Index<&Q>`]index().&elt]rust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`Index<&Q>`]index()., elt);
37 }
38 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?}", map);
39
40 for &elt in &not_present {
41 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(map.getrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get().(&elt).is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
42 }
43 }
44
45 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
46 fn insert_fullrust-analyzer cargo ordermap 1.2.0 map/tests/insert_full().() {
47 let insert = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![9, 2, 7, 1, 4, 6, 13];
48 let present = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1, 6, 2];
49 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::with_capacityrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]with_capacity().(insert.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().());
50
51 for (i, &elt) in insert.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() {
52 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), i);
53 let (index, existing) = map.insert_fullrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert_full().(elt, elt);
54 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(existing, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
55 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(index), map.get_fullrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_full().(&elt).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|x| x.0));
56 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), i +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1);
57 }
58
59 let len = map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().();
60 for &elt in &present {
61 let (index, existing) = map.insert_fullrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert_full().(elt, elt);
62 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(existing, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(elt));
63 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(index), map.get_fullrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_full().(&elt).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|x| x.0));
64 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), len);
65 }
66 }
67
68 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
69 fn insert_2rust-analyzer cargo ordermap 1.2.0 map/tests/insert_2().() {
70 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::with_capacityrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]with_capacity().(16);
71
72 let mut keys = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![];
73 keys.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#16);
74 keys.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(if cfgrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/cfg!!(miri) { 32..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#64 } else { 128..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#267 });
75
76 for &i in &keys {
77 let old_map = map.clonerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][Clone]clone().();
78 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(i, ());
79 for key in old_map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().() {
80 if map.getrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get().(key).is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() {
81 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("old_map: {:?}", old_map);
82 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("map: {:?}", map);
83 panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("did not find {} in map", key);
84 }
85 }
86 }
87
88 for &i in &keys {
89 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(map.getrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get().(&i).is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().(), "did not find {}", i);
90 }
91 }
92
93 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
94 fn insert_orderrust-analyzer cargo ordermap 1.2.0 map/tests/insert_order().() {
95 let insert = [0, 4, 2, 12, 8, 7, 11, 5, 3, 17, 19, 22, 23];
96 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
97
98 for &elt in &insert {
99 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(elt, ());
100 }
101
102 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().().countrust-analyzer cargo indexmap 2.14.0 map/iter/impl#[`Keys<'a, K, V>`][Iterator]count().(), map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().());
103 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().().countrust-analyzer cargo indexmap 2.14.0 map/iter/impl#[`Keys<'a, K, V>`][Iterator]count().(), insert.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().());
104 for (a, b) in insert.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().()) {
105 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a, b);
106 }
107 for (i, k) in (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#insert.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()).ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().()) {
108 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.get_indexrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_index().(i).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().0, k);
109 }
110 }
111
112 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
113 fn shift_insertrust-analyzer cargo ordermap 1.2.0 map/tests/shift_insert().() {
114 let insert = [0, 4, 2, 12, 8, 7, 11, 5, 3, 17, 19, 22, 23];
115 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
116
117 for &elt in &insert {
118 map.shift_insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]shift_insert().(0, elt, ());
119 }
120
121 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().().countrust-analyzer cargo indexmap 2.14.0 map/iter/impl#[`Keys<'a, K, V>`][Iterator]count().(), map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().());
122 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().().countrust-analyzer cargo indexmap 2.14.0 map/iter/impl#[`Keys<'a, K, V>`][Iterator]count().(), insert.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().());
123 for (a, b) in insert.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().()) {
124 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a, b);
125 }
126 for (i, k) in (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#insert.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()).ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().()) {
127 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.get_indexrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_index().(i).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().0, k);
128 }
129
130 // "insert" that moves an existing entry
131 map.shift_insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]shift_insert().(0, insert[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., ());
132 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().().countrust-analyzer cargo indexmap 2.14.0 map/iter/impl#[`Keys<'a, K, V>`][Iterator]count().(), insert.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().());
133 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(insert[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().()[rust-analyzer cargo indexmap 2.14.0 map/iter/impl#[`Keys<'_, K, V>`][`Index<usize>`]index().0]rust-analyzer cargo indexmap 2.14.0 map/iter/impl#[`Keys<'_, K, V>`][`Index<usize>`]index().);
134 for (a, b) in insert[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().().skiprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#skip().(1)) {
135 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a, b);
136 }
137 }
138
139 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
140 fn insert_sorted_badrust-analyzer cargo ordermap 1.2.0 map/tests/insert_sorted_bad().() {
141 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
142 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(10, ());
143 for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10 {
144 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(i, ());
145 }
146
147 // The binary search will want to insert this at the end (index == len()),
148 // but that's only possible for *new* inserts. It should still be handled
149 // without panicking though, and in this case it's simple enough that we
150 // know the exact result. (But don't read this as an API guarantee!)
151 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.firstrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]first().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&10, &())));
152 map.insert_sortedrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert_sorted().(10, ());
153 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lastrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]last().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&10, &())));
154 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(0..=10));
155
156 // Other out-of-order entries can also "insert" to a binary-searched
157 // position, moving in either direction.
158 map.move_indexrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]move_index().(5, 0);
159 map.move_indexrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]move_index().(6, 10);
160 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.firstrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]first().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&5, &())));
161 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lastrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]last().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&6, &())));
162 map.insert_sortedrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert_sorted().(5, ()); // moves back up
163 map.insert_sortedrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert_sorted().(6, ()); // moves back down
164 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(0..=10));
165 }
166
167 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
168 fn growrust-analyzer cargo ordermap 1.2.0 map/tests/grow().() {
169 let insert = [0, 4, 2, 12, 8, 7, 11];
170 let not_present = [1, 3, 6, 9, 10];
171 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::with_capacityrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]with_capacity().(insert.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().());
172
173 for (i, &elt) in insert.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() {
174 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), i);
175 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(elt, elt);
176 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), i +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1);
177 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.getrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get().(&elt), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&elt));
178 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map[rust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`Index<&Q>`]index().&elt]rust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`Index<&Q>`]index()., elt);
179 }
180
181 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?}", map);
182 for &elt in &insert {
183 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(elt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().10, elt);
184 }
185 for &elt in &insert {
186 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(elt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().100, elt);
187 }
188 for (i, &elt) in insert.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().cyclerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cycle().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().().takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().(100) {
189 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(elt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().100 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Add<Self>`]add().i as i32, elt);
190 }
191 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?}", map);
192 for &elt in &not_present {
193 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(map.getrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get().(&elt).is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
194 }
195 }
196
197 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
198 fn reserverust-analyzer cargo ordermap 1.2.0 map/tests/reserve().() {
199 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::<usize, usize>::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
200 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.capacityrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]capacity().(), 0);
201 map.reserverust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]reserve().(100);
202 let capacity = map.capacityrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]capacity().();
203 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(capacity >= 100);
204 for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#capacity {
205 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), i);
206 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(i, i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().i);
207 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), i +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1);
208 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.capacityrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]capacity().(), capacity);
209 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.getrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get().(&i), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&(i *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). i)));
210 }
211 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(capacity, stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::usizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/usize/::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/usize/MAX.);
212 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), capacity +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1);
213 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(map.capacityrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]capacity().() >rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). capacity);
214 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.getrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get().(&capacity), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::usizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/usize/::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/usize/MAX.));
215 }
216
217 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
218 fn try_reserverust-analyzer cargo ordermap 1.2.0 map/tests/try_reserve().() {
219 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::<usize, usize>::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
220 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.capacityrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]capacity().(), 0);
221 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.try_reserverust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]try_reserve().(100), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()));
222 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(map.capacityrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]capacity().() >= 100);
223 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(map.try_reserverust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]try_reserve().(usize::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]MAX.).is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
224 }
225
226 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
227 fn shrink_to_fitrust-analyzer cargo ordermap 1.2.0 map/tests/shrink_to_fit().() {
228 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::<usize, usize>::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
229 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.capacityrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]capacity().(), 0);
230 for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#100 {
231 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), i);
232 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(i, i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().i);
233 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), i +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1);
234 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(map.capacityrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]capacity().() >= i +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1);
235 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.getrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get().(&i), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&(i *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). i)));
236 map.shrink_to_fitrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]shrink_to_fit().();
237 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), i +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1);
238 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.capacityrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]capacity().(), i +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1);
239 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.getrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get().(&i), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&(i *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). i)));
240 }
241 }
242
243 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
244 fn removerust-analyzer cargo ordermap 1.2.0 map/tests/remove().() {
245 let insert = [0, 4, 2, 12, 8, 7, 11, 5, 3, 17, 19, 22, 23];
246 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
247
248 for &elt in &insert {
249 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(elt, elt);
250 }
251
252 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().().countrust-analyzer cargo indexmap 2.14.0 map/iter/impl#[`Keys<'a, K, V>`][Iterator]count().(), map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().());
253 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().().countrust-analyzer cargo indexmap 2.14.0 map/iter/impl#[`Keys<'a, K, V>`][Iterator]count().(), insert.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().());
254 for (a, b) in insert.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().()) {
255 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a, b);
256 }
257
258 let remove_fail = [99, 77];
259 let remove = [4, 12, 8, 7];
260
261 for &key in &remove_fail {
262 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(map.swap_remove_fullrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]swap_remove_full().(&key).is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
263 }
264 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?}", map);
265 for &key in &remove {
266 //println!("{:?}", map);
267 let index = map.get_fullrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_full().(&key).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().0;
268 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.swap_remove_fullrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]swap_remove_full().(&key), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((index, key, key)));
269 }
270 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?}", map);
271
272 for key in &insert {
273 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.getrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get().(key).is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().(), !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().remove.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(key));
274 }
275 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), insert.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). remove.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().());
276 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().().countrust-analyzer cargo indexmap 2.14.0 map/iter/impl#[`Keys<'a, K, V>`][Iterator]count().(), insert.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). remove.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().());
277 }
278
279 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
280 fn remove_to_emptyrust-analyzer cargo ordermap 1.2.0 map/tests/remove_to_empty().() {
281 let mut map = ordermaprust-analyzer cargo ordermap 1.2.0 macros/ordermap!! { 0 => 0, 4 => 4, 5 => 5 };
282 map.swap_removerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]swap_remove().(&5).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
283 map.swap_removerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]swap_remove().(&4).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
284 map.swap_removerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]swap_remove().(&0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
285 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(map.is_emptyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]is_empty().());
286 }
287
288 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
289 fn swap_remove_indexrust-analyzer cargo ordermap 1.2.0 map/tests/swap_remove_index().() {
290 let insert = [0, 4, 2, 12, 8, 7, 11, 5, 3, 17, 19, 22, 23];
291 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
292
293 for &elt in &insert {
294 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(elt, elt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().2);
295 }
296
297 let mut vector = insert.to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().();
298 let remove_sequence = &[3, 3, 10, 4, 5, 4, 3, 0, 1];
299
300 // check that the same swap remove sequence on vec and map
301 // have the same result.
302 for &rm in remove_sequence {
303 let out_vec = vector.swap_removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]swap_remove().(rm);
304 let (out_map, _) = map.swap_remove_indexrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]swap_remove_index().(rm).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
305 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(out_vec, out_map);
306 }
307 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(vector.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().());
308 for (a, b) in vector.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().()) {
309 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a, b);
310 }
311 }
312
313 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
314 fn partial_eq_and_eqrust-analyzer cargo ordermap 1.2.0 map/tests/partial_eq_and_eq().() {
315 let mut map_a = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
316 map_a.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, "1");
317 map_a.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(2, "2");
318 let mut map_b = map_a.clonerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][Clone]clone().();
319 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map_a, map_b);
320 map_b.swap_removerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]swap_remove().(&1);
321 assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(map_a, map_b);
322 }
323
324 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
325 fn extendrust-analyzer cargo ordermap 1.2.0 map/tests/extend().() {
326 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
327 map.extendrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`Extend<(&'a K, &'a V)>`]extend().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(&1, &2), (&3, &4)]);
328 map.extendrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`Extend<(K, V)>`]extend().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(5, 6)]);
329 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
330 map.into_iterrust-analyzer cargo ordermap 1.2.0 map/iter/impl#[`OrderMap<K, V, S>`][IntoIterator]into_iter().().collectrust-analyzer cargo indexmap 2.14.0 map/iter/impl#[`IntoIter<K, V>`][Iterator]collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(),
331 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1, 2), (3, 4), (5, 6)]
332 );
333 }
334
335 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
336 fn entryrust-analyzer cargo ordermap 1.2.0 map/tests/entry().() {
337 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
338
339 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, "1");
340 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(2, "2");
341 {
342 let e = map.entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]entry().(3);
343 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e.indexrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`Entry<'a, K, V>`]index().(), 2);
344 let e = e.or_insertrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`Entry<'a, K, V>`]or_insert().("3");
345 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e, &"3");
346 }
347
348 let e = map.entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]entry().(2);
349 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e.indexrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`Entry<'a, K, V>`]index().(), 1);
350 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e.keyrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`Entry<'a, K, V>`]key().(), &2);
351 match e {
352 Entryrust-analyzer cargo ordermap 1.2.0 map/entry/Entry#::Occupiedrust-analyzer cargo ordermap 1.2.0 map/entry/Entry#Occupied#(ref e) => assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e.getrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`OccupiedEntry<'a, K, V>`]get().(), &"2"),
353 Entryrust-analyzer cargo ordermap 1.2.0 map/entry/Entry#::Vacantrust-analyzer cargo ordermap 1.2.0 map/entry/Entry#Vacant#(_) => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!(),
354 }
355 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e.or_insertrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`Entry<'a, K, V>`]or_insert().("4"), &"2");
356 }
357
358 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
359 fn entry_and_modifyrust-analyzer cargo ordermap 1.2.0 map/tests/entry_and_modify().() {
360 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
361
362 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, "1");
363 map.entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]entry().(1).and_modifyrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`Entry<'a, K, V>`]and_modify().(|x| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().x = "2");
364 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&"2"), map.getrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get().(&1));
365
366 map.entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]entry().(2).and_modifyrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`Entry<'a, K, V>`]and_modify().(|x| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().x = "doesn't exist");
367 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, map.getrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get().(&2));
368 }
369
370 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
371 fn entry_or_defaultrust-analyzer cargo ordermap 1.2.0 map/tests/entry_or_default().() {
372 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
373
374 #[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:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
375 enum TestEnumrust-analyzer cargo ordermap 1.2.0 map/tests/TestEnum# {
376 DefaultValuerust-analyzer cargo ordermap 1.2.0 map/tests/TestEnum#DefaultValue#,
377 NonDefaultValuerust-analyzer cargo ordermap 1.2.0 map/tests/TestEnum#NonDefaultValue#,
378 }
379
380 impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for TestEnumrust-analyzer cargo ordermap 1.2.0 map/tests/TestEnum# {
381 fn defaultrust-analyzer cargo ordermap 1.2.0 map/tests/impl#[TestEnum][Default]default().() -> Selfrust-analyzer cargo ordermap 1.2.0 map/tests/impl#[TestEnum][Default] {
382 TestEnumrust-analyzer cargo ordermap 1.2.0 map/tests/TestEnum#::DefaultValuerust-analyzer cargo ordermap 1.2.0 map/tests/TestEnum#DefaultValue#
383 }
384 }
385
386 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, TestEnumrust-analyzer cargo ordermap 1.2.0 map/tests/TestEnum#::NonDefaultValuerust-analyzer cargo ordermap 1.2.0 map/tests/TestEnum#NonDefaultValue#);
387 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&mut TestEnumrust-analyzer cargo ordermap 1.2.0 map/tests/TestEnum#::NonDefaultValuerust-analyzer cargo ordermap 1.2.0 map/tests/TestEnum#NonDefaultValue#, map.entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]entry().(1).or_defaultrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`Entry<'a, K, V>`]or_default().());
388
389 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&mut TestEnumrust-analyzer cargo ordermap 1.2.0 map/tests/TestEnum#::DefaultValuerust-analyzer cargo ordermap 1.2.0 map/tests/TestEnum#DefaultValue#, map.entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]entry().(2).or_defaultrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`Entry<'a, K, V>`]or_default().());
390 }
391
392 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
393 fn occupied_entry_keyrust-analyzer cargo ordermap 1.2.0 map/tests/occupied_entry_key().() {
394 // These keys match hash and equality, but their addresses are distinct.
395 let (k1, k2) = (&mut 1, &mut 1);
396 let k1_ptr = k1 as *const i32;
397 let k2_ptr = k2 as *const i32;
398 assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(k1_ptr, k2_ptr);
399
400 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
401 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(k1, "value");
402 match map.entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]entry().(k2) {
403 Entryrust-analyzer cargo ordermap 1.2.0 map/entry/Entry#::Occupiedrust-analyzer cargo ordermap 1.2.0 map/entry/Entry#Occupied#(ref e) => {
404 // `OccupiedEntry::key` should reference the key in the map,
405 // not the key that was used to find the entry.
406 let ptr = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().e.keyrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`OccupiedEntry<'a, K, V>`]key().() as *const i32;
407 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(ptr, k1_ptr);
408 assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(ptr, k2_ptr);
409 }
410 Entryrust-analyzer cargo ordermap 1.2.0 map/entry/Entry#::Vacantrust-analyzer cargo ordermap 1.2.0 map/entry/Entry#Vacant#(_) => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!(),
411 }
412 }
413
414 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
415 fn get_index_entryrust-analyzer cargo ordermap 1.2.0 map/tests/get_index_entry().() {
416 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
417
418 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(map.get_index_entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_index_entry().(0).is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
419 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(map.first_entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]first_entry().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
420 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(map.last_entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]last_entry().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
421
422 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(0, "0");
423 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, "1");
424 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(2, "2");
425 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(3, "3");
426
427 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(map.get_index_entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_index_entry().(4).is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
428
429 {
430 let e = map.get_index_entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_index_entry().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
431 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().e.keyrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`IndexedEntry<'a, K, V>`]key().(), 1);
432 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().e.getrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`IndexedEntry<'a, K, V>`]get().(), "1");
433 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e.swap_removerust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`IndexedEntry<'a, K, V>`]swap_remove().(), "1");
434 }
435
436 {
437 let mut e = map.get_index_entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_index_entry().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
438 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().e.keyrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`IndexedEntry<'a, K, V>`]key().(), 3);
439 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().e.getrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`IndexedEntry<'a, K, V>`]get().(), "3");
440 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e.insertrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`IndexedEntry<'a, K, V>`]insert().("4"), "3");
441 }
442
443 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().map.getrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get().(&3).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), "4");
444
445 {
446 let e = map.first_entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]first_entry().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
447 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().e.keyrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`IndexedEntry<'a, K, V>`]key().(), 0);
448 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().e.getrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`IndexedEntry<'a, K, V>`]get().(), "0");
449 }
450
451 {
452 let e = map.last_entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]last_entry().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
453 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().e.keyrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`IndexedEntry<'a, K, V>`]key().(), 2);
454 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().e.getrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`IndexedEntry<'a, K, V>`]get().(), "2");
455 }
456 }
457
458 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
459 fn from_entriesrust-analyzer cargo ordermap 1.2.0 map/tests/from_entries().() {
460 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::fromrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`][`From<[(K, V); N]>`]from().([(1, "1"), (2, "2"), (3, "3")]);
461
462 {
463 let e = match map.entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]entry().(1) {
464 Entryrust-analyzer cargo ordermap 1.2.0 map/entry/Entry#::Occupiedrust-analyzer cargo ordermap 1.2.0 map/entry/Entry#Occupied#(e) => IndexedEntryrust-analyzer cargo ordermap 1.2.0 map/entry/IndexedEntry#::fromrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`IndexedEntry<'a, K, V>`][`From<OccupiedEntry<'a, K, V>>`]from().(e),
465 Entryrust-analyzer cargo ordermap 1.2.0 map/entry/Entry#::Vacantrust-analyzer cargo ordermap 1.2.0 map/entry/Entry#Vacant#(_) => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!(),
466 };
467 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e.indexrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`IndexedEntry<'a, K, V>`]index().(), 0);
468 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().e.keyrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`IndexedEntry<'a, K, V>`]key().(), 1);
469 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().e.getrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`IndexedEntry<'a, K, V>`]get().(), "1");
470 }
471
472 {
473 let e = match map.get_index_entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_index_entry().(1) {
474 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(e) => OccupiedEntryrust-analyzer cargo ordermap 1.2.0 map/entry/OccupiedEntry#::fromrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`OccupiedEntry<'a, K, V>`][`From<IndexedEntry<'a, K, V>>`]from().(e),
475 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!(),
476 };
477 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e.indexrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`OccupiedEntry<'a, K, V>`]index().(), 1);
478 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().e.keyrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`OccupiedEntry<'a, K, V>`]key().(), 2);
479 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().e.getrust-analyzer cargo ordermap 1.2.0 map/entry/impl#[`OccupiedEntry<'a, K, V>`]get().(), "2");
480 }
481 }
482
483 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
484 fn keysrust-analyzer cargo ordermap 1.2.0 map/tests/keys().() {
485 let vec = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1, 'a'), (2, 'b'), (3, 'c')];
486 let map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, _> = vec.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
487 let keys: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
488 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(keys.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 3);
489 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(keys.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&1));
490 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(keys.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&2));
491 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(keys.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&3));
492 }
493
494 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
495 fn into_keysrust-analyzer cargo ordermap 1.2.0 map/tests/into_keys().() {
496 let vec = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1, 'a'), (2, 'b'), (3, 'c')];
497 let map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, _> = vec.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
498 let keys: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<i32> = map.into_keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]into_keys().().collectrust-analyzer cargo indexmap 2.14.0 map/iter/impl#[`IntoKeys<K, V>`][Iterator]collect().();
499 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(keys.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 3);
500 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(keys.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&1));
501 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(keys.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&2));
502 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(keys.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&3));
503 }
504
505 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
506 fn valuesrust-analyzer cargo ordermap 1.2.0 map/tests/values().() {
507 let vec = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1, 'a'), (2, 'b'), (3, 'c')];
508 let map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, _> = vec.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
509 let values: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = map.valuesrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]values().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
510 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(values.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 3);
511 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(values.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&'a'));
512 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(values.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&'b'));
513 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(values.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&'c'));
514 }
515
516 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
517 fn values_mutrust-analyzer cargo ordermap 1.2.0 map/tests/values_mut().() {
518 let vec = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1, 1), (2, 2), (3, 3)];
519 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, _> = vec.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
520 for value in map.values_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]values_mut().() {
521 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`MulAssign<Self>`]mul_assign().*=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`MulAssign<Self>`]mul_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`MulAssign<Self>`]mul_assign().2
522 }
523 let values: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = map.valuesrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]values().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
524 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(values.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 3);
525 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(values.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&2));
526 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(values.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&4));
527 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(values.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&6));
528 }
529
530 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
531 fn into_valuesrust-analyzer cargo ordermap 1.2.0 map/tests/into_values().() {
532 let vec = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1, 'a'), (2, 'b'), (3, 'c')];
533 let map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, _> = vec.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
534 let values: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<char> = map.into_valuesrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]into_values().().collectrust-analyzer cargo indexmap 2.14.0 map/iter/impl#[`IntoValues<K, V>`][Iterator]collect().();
535 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(values.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 3);
536 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(values.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&'a'));
537 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(values.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&'b'));
538 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(values.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&'c'));
539 }
540
541 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
542 fn drain_rangerust-analyzer cargo ordermap 1.2.0 map/tests/drain_range().() {
543 // Test the various heuristics of `erase_indices`
544 for range in [
545 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#0, // nothing erased
546 10..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#90, // reinsert the few kept (..10 and 90..)
547 80..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#90, // update the few to adjust (80..)
548 20..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#30, // sweep everything
549 ] {
550 let mut vec = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::from_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`][`FromIterator<T>`]from_iter().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#100);
551 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, ()> = (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#100).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|i| (i, ())).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
552 droprust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/drop().(vec.drainrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]drain().(range.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`Range<Idx>`][Clone]clone().()));
553 droprust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/drop().(map.drainrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]drain().(range));
554 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(vec.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(map.keysrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]keys().()));
555 for (i, x) in vec.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() {
556 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.get_index_ofrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_index_of().(x), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(i));
557 }
558 }
559 }
560
561 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
562 #[cfg(feature = "std")]
563 fn from_arrayrust-analyzer cargo ordermap 1.2.0 map/tests/from_array().() {
564 let map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::fromrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`][`From<[(K, V); N]>`]from().([(1, 2), (3, 4)]);
565 let mut expected = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
566 expected.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, 2);
567 expected.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(3, 4);
568
569 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map, expected)
570 }
571
572 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
573 fn iter_defaultrust-analyzer cargo ordermap 1.2.0 map/tests/iter_default().() {
574 struct Krust-analyzer cargo ordermap 1.2.0 map/tests/K#;
575 struct Vrust-analyzer cargo ordermap 1.2.0 map/tests/V#;
576 fn assert_defaultrust-analyzer cargo ordermap 1.2.0 map/tests/assert_default().<T>()
577 where
578 T: Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# + Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#,
579 {
580 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(T::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#default().().nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
581 }
582 assert_defaultrust-analyzer cargo ordermap 1.2.0 map/tests/assert_default().::<Iterrust-analyzer cargo indexmap 2.14.0 map/iter/Iter#<'static, Krust-analyzer cargo ordermap 1.2.0 map/tests/K#, Vrust-analyzer cargo ordermap 1.2.0 map/tests/V#>>();
583 assert_defaultrust-analyzer cargo ordermap 1.2.0 map/tests/assert_default().::<IterMutrust-analyzer cargo indexmap 2.14.0 map/iter/IterMut#<'static, Krust-analyzer cargo ordermap 1.2.0 map/tests/K#, Vrust-analyzer cargo ordermap 1.2.0 map/tests/V#>>();
584 assert_defaultrust-analyzer cargo ordermap 1.2.0 map/tests/assert_default().::<IterMut2rust-analyzer cargo indexmap 2.14.0 map/iter/IterMut2#<'static, Krust-analyzer cargo ordermap 1.2.0 map/tests/K#, Vrust-analyzer cargo ordermap 1.2.0 map/tests/V#>>();
585 assert_defaultrust-analyzer cargo ordermap 1.2.0 map/tests/assert_default().::<IntoIterrust-analyzer cargo indexmap 2.14.0 map/iter/IntoIter#<Krust-analyzer cargo ordermap 1.2.0 map/tests/K#, Vrust-analyzer cargo ordermap 1.2.0 map/tests/V#>>();
586 assert_defaultrust-analyzer cargo ordermap 1.2.0 map/tests/assert_default().::<Keysrust-analyzer cargo indexmap 2.14.0 map/iter/Keys#<'static, Krust-analyzer cargo ordermap 1.2.0 map/tests/K#, Vrust-analyzer cargo ordermap 1.2.0 map/tests/V#>>();
587 assert_defaultrust-analyzer cargo ordermap 1.2.0 map/tests/assert_default().::<IntoKeysrust-analyzer cargo indexmap 2.14.0 map/iter/IntoKeys#<Krust-analyzer cargo ordermap 1.2.0 map/tests/K#, Vrust-analyzer cargo ordermap 1.2.0 map/tests/V#>>();
588 assert_defaultrust-analyzer cargo ordermap 1.2.0 map/tests/assert_default().::<Valuesrust-analyzer cargo indexmap 2.14.0 map/iter/Values#<'static, Krust-analyzer cargo ordermap 1.2.0 map/tests/K#, Vrust-analyzer cargo ordermap 1.2.0 map/tests/V#>>();
589 assert_defaultrust-analyzer cargo ordermap 1.2.0 map/tests/assert_default().::<ValuesMutrust-analyzer cargo indexmap 2.14.0 map/iter/ValuesMut#<'static, Krust-analyzer cargo ordermap 1.2.0 map/tests/K#, Vrust-analyzer cargo ordermap 1.2.0 map/tests/V#>>();
590 assert_defaultrust-analyzer cargo ordermap 1.2.0 map/tests/assert_default().::<IntoValuesrust-analyzer cargo indexmap 2.14.0 map/iter/IntoValues#<Krust-analyzer cargo ordermap 1.2.0 map/tests/K#, Vrust-analyzer cargo ordermap 1.2.0 map/tests/V#>>();
591 }
592
593 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
594 fn get_index_mut2rust-analyzer cargo ordermap 1.2.0 map/tests/get_index_mut2().() {
595 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
596 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, 2);
597 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(3, 4);
598 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(5, 6);
599
600 {
601 let (key, value) = map.get_index_mut2rust-analyzer cargo ordermap 1.2.0 map/mutable/impl#[`OrderMap<K, V, S>`][MutableKeys]get_index_mut2().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
602 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().key, 1);
603 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value, 2);
604
605 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value = 7;
606 }
607 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map[rust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`Index<usize>`]index().0]rust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`Index<usize>`]index()., 7);
608
609 {
610 let (key, _) = map.get_index_mut2rust-analyzer cargo ordermap 1.2.0 map/mutable/impl#[`OrderMap<K, V, S>`][MutableKeys]get_index_mut2().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
611 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().key = 8;
612 }
613 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.get_indexrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_index().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().0, &8);
614 }
615
616 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
617 fn shift_shift_remove_indexrust-analyzer cargo ordermap 1.2.0 map/tests/shift_shift_remove_index().() {
618 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
619 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, 2);
620 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(3, 4);
621 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(5, 6);
622 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(7, 8);
623 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(9, 10);
624
625 let result = map.remove_indexrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]remove_index().(1);
626 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(result, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((3, 4)));
627 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), 4);
628 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.as_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_slice().(), &[(1, 2), (5, 6), (7, 8), (9, 10)]);
629
630 let result = map.remove_indexrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]remove_index().(1);
631 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(result, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((5, 6)));
632 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), 3);
633 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.as_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_slice().(), &[(1, 2), (7, 8), (9, 10)]);
634
635 let result = map.remove_indexrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]remove_index().(2);
636 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(result, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((9, 10)));
637 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), 2);
638 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.as_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_slice().(), &[(1, 2), (7, 8)]);
639
640 let result = map.remove_indexrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]remove_index().(2);
641 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(result, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
642 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), 2);
643 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.as_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_slice().(), &[(1, 2), (7, 8)]);
644 }
645
646 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
647 fn shift_remove_entryrust-analyzer cargo ordermap 1.2.0 map/tests/shift_remove_entry().() {
648 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
649 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, 2);
650 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(3, 4);
651 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(5, 6);
652 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(7, 8);
653 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(9, 10);
654
655 let result = map.remove_entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]remove_entry().(&3);
656 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(result, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((3, 4)));
657 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), 4);
658 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.as_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_slice().(), &[(1, 2), (5, 6), (7, 8), (9, 10)]);
659
660 let result = map.remove_entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]remove_entry().(&9);
661 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(result, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((9, 10)));
662 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), 3);
663 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.as_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_slice().(), &[(1, 2), (5, 6), (7, 8)]);
664
665 let result = map.remove_entryrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]remove_entry().(&9);
666 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(result, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
667 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), 3);
668 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.as_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_slice().(), &[(1, 2), (5, 6), (7, 8)]);
669 }
670
671 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
672 fn shift_remove_fullrust-analyzer cargo ordermap 1.2.0 map/tests/shift_remove_full().() {
673 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
674 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, 2);
675 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(3, 4);
676 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(5, 6);
677 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(7, 8);
678 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(9, 10);
679
680 let result = map.remove_fullrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]remove_full().(&3);
681 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(result, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((1, 3, 4)));
682 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), 4);
683 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.as_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_slice().(), &[(1, 2), (5, 6), (7, 8), (9, 10)]);
684
685 let result = map.remove_fullrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]remove_full().(&9);
686 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(result, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((3, 9, 10)));
687 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), 3);
688 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.as_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_slice().(), &[(1, 2), (5, 6), (7, 8)]);
689
690 let result = map.remove_fullrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]remove_full().(&9);
691 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(result, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
692 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), 3);
693 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.as_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_slice().(), &[(1, 2), (5, 6), (7, 8)]);
694 }
695
696 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
697 fn sorted_unstable_byrust-analyzer cargo ordermap 1.2.0 map/tests/sorted_unstable_by().() {
698 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
699 map.extendrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`Extend<(K, V)>`]extend().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50)]);
700 let sorted = map.sorted_unstable_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]sorted_unstable_by().(|_a, b, _c, d| d.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&b));
701
702 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
703 sorted.as_slicerust-analyzer cargo indexmap 2.14.0 map/iter/impl#[`IntoIter<K, V>`]as_slice().(),
704 &[(5, 50), (4, 40), (3, 30), (2, 20), (1, 10)]
705 );
706 }
707
708 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
709 fn into_boxed_slicerust-analyzer cargo ordermap 1.2.0 map/tests/into_boxed_slice().() {
710 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
711 for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#5 {
712 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(i, i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().10);
713 }
714 let boxed_slice: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32>> = map.into_boxed_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]into_boxed_slice().();
715 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(boxed_slice.lenrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]len().(), 5);
716 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
717 boxed_slice.as_refrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][`AsRef<T>`]as_ref().(),
718 &[(0, 0), (1, 10), (2, 20), (3, 30), (4, 40)]
719 );
720 }
721
722 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
723 fn last_mutrust-analyzer cargo ordermap 1.2.0 map/tests/last_mut().() {
724 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<&str, i32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
725
726 let last_entry = map.last_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]last_mut().();
727 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(last_entry, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
728
729 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().("key1", 1);
730 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().("key2", 2);
731 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().("key3", 3);
732 let last_entry = map.last_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]last_mut().();
733 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(last_entry, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&"key3", &mut 3)));
734
735 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().last_entry.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().1 = 4;
736 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.getrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get().("key3"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&4));
737 }
738
739 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
740 #[should_panic = "index out of bounds"]
741 fn insert_before_oobrust-analyzer cargo ordermap 1.2.0 map/tests/insert_before_oob().() {
742 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<char, ()> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
743 let _ = map.insert_beforerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert_before().(0, 'a', ());
744 let _ = map.insert_beforerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert_before().(1, 'b', ());
745 map.insert_beforerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert_before().(3, 'd', ());
746 }
747
748 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
749 fn clearrust-analyzer cargo ordermap 1.2.0 map/tests/clear().() {
750 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
751 map.extendrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`Extend<(K, V)>`]extend().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50)]);
752 map.clearrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]clear().();
753 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]len().(), 0);
754 }
755
756 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
757 fn get_rangerust-analyzer cargo ordermap 1.2.0 map/tests/get_range().() {
758 let mut index_map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
759 index_map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, 10);
760 index_map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(2, 20);
761 index_map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(3, 30);
762 index_map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(4, 40);
763 index_map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(5, 50);
764
765 let result = index_map.get_rangerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_range().(2..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#2);
766 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(result.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().is_emptyrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]is_empty().());
767
768 let result = index_map.get_rangerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_range().(4..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#2);
769 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(result.is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
770
771 let result = index_map.get_rangerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_range().(2..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#4);
772 let slice: &Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32> = result.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
773 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(slice.lenrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]len().(), 2);
774 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(slice, &[(3, 30), (4, 40)]);
775 }
776
777 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
778 fn get_range_mutrust-analyzer cargo ordermap 1.2.0 map/tests/get_range_mut().() {
779 let mut index_map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
780 index_map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, 10);
781 index_map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(2, 20);
782 index_map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(3, 30);
783 index_map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(4, 40);
784 index_map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(5, 50);
785
786 let result = index_map.get_range_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_range_mut().(2..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#2);
787 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(result.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().is_emptyrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]is_empty().());
788
789 let result = index_map.get_range_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_range_mut().(4..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#2);
790 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(result.is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
791
792 let result = index_map.get_range_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_range_mut().(2..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#4);
793 let slice: &mut Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32> = result.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
794 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(slice.lenrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]len().(), 2);
795 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(slice, &mut [(3, 30), (4, 40)]);
796
797 for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#slice.lenrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]len().() {
798 slice[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().1;
799 }
800 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(slice, &mut [(3, 31), (4, 41)]);
801 }
802
803 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
804 #[should_panic = "index out of bounds"]
805 fn shift_insert_oobrust-analyzer cargo ordermap 1.2.0 map/tests/shift_insert_oob().() {
806 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<u32, u32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
807 map.shift_insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]shift_insert().(0, 1, 10);
808 map.shift_insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]shift_insert().(1, 2, 20);
809 map.shift_insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]shift_insert().(2, 3, 30);
810 map.shift_insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]shift_insert().(5, 4, 40);
811 }
812
813 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
814 fn test_binary_search_byrust-analyzer cargo ordermap 1.2.0 map/tests/test_binary_search_by().() {
815 // adapted from std's test for binary_search
816 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = []
817 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
818 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
819 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
820 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
821 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&5)), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(0));
822
823 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = [4]
824 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
825 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
826 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
827 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
828 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&3)), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(0));
829 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&4)), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0));
830 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&5)), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(1));
831
832 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = [1, 2, 4, 6, 8, 9]
833 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
834 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
835 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
836 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
837 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&5)), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(3));
838 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&6)), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(3));
839 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&7)), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(4));
840 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&8)), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(4));
841
842 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = [1, 2, 4, 5, 6, 8]
843 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
844 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
845 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
846 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
847 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&9)), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(6));
848
849 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = [1, 2, 4, 6, 7, 8, 9]
850 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
851 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
852 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
853 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
854 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&6)), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(3));
855 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&5)), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(3));
856 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&8)), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(5));
857
858 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = [1, 2, 4, 5, 6, 8, 9]
859 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
860 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
861 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
862 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
863 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&7)), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(5));
864 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&0)), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(0));
865
866 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = [1, 3, 3, 3, 7]
867 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
868 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
869 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
870 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
871 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&0)), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(0));
872 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&1)), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0));
873 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&2)), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(1));
874 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(match b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&3)) {
875 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(1..=3) => true,
876 _ => false,
877 });
878 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(match b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&3)) {
879 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(1..=3) => true,
880 _ => false,
881 });
882 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&4)), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(4));
883 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&5)), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(4));
884 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&6)), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(4));
885 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&7)), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(4));
886 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by().(|_, x| x.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(&8)), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(5));
887 }
888
889 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
890 fn test_binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/tests/test_binary_search_by_key().() {
891 // adapted from std's test for binary_search
892 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = []
893 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
894 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
895 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
896 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
897 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&5, |_, &x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(0));
898
899 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = [4]
900 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
901 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
902 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
903 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
904 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&3, |_, &x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(0));
905 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&4, |_, &x| x), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0));
906 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&5, |_, &x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(1));
907
908 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = [1, 2, 4, 6, 8, 9]
909 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
910 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
911 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
912 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
913 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&5, |_, &x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(3));
914 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&6, |_, &x| x), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(3));
915 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&7, |_, &x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(4));
916 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&8, |_, &x| x), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(4));
917
918 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = [1, 2, 4, 5, 6, 8]
919 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
920 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
921 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
922 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
923 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&9, |_, &x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(6));
924
925 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = [1, 2, 4, 6, 7, 8, 9]
926 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
927 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
928 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
929 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
930 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&6, |_, &x| x), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(3));
931 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&5, |_, &x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(3));
932 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&8, |_, &x| x), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(5));
933
934 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = [1, 2, 4, 5, 6, 8, 9]
935 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
936 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
937 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
938 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
939 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&7, |_, &x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(5));
940 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&0, |_, &x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(0));
941
942 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = [1, 3, 3, 3, 7]
943 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
944 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
945 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
946 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
947 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&0, |_, &x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(0));
948 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&1, |_, &x| x), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0));
949 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&2, |_, &x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(1));
950 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(match b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&3, |_, &x| x) {
951 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(1..=3) => true,
952 _ => false,
953 });
954 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(match b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&3, |_, &x| x) {
955 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(1..=3) => true,
956 _ => false,
957 });
958 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&4, |_, &x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(4));
959 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&5, |_, &x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(4));
960 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&6, |_, &x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(4));
961 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&7, |_, &x| x), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(4));
962 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]binary_search_by_key().(&8, |_, &x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(5));
963 }
964
965 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
966 fn test_partition_pointrust-analyzer cargo ordermap 1.2.0 map/tests/test_partition_point().() {
967 // adapted from std's test for partition_point
968 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = []
969 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
970 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
971 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
972 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
973 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 5), 0);
974
975 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = [4]
976 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
977 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
978 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
979 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
980 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 3), 0);
981 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 4), 0);
982 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 5), 1);
983
984 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = [1, 2, 4, 6, 8, 9]
985 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
986 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
987 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
988 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
989 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 5), 3);
990 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 6), 3);
991 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 7), 4);
992 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 8), 4);
993
994 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = [1, 2, 4, 5, 6, 8]
995 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
996 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
997 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
998 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
999 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 9), 6);
1000
1001 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = [1, 2, 4, 6, 7, 8, 9]
1002 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
1003 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
1004 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
1005 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1006 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 6), 3);
1007 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 5), 3);
1008 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 8), 5);
1009
1010 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = [1, 2, 4, 5, 6, 8, 9]
1011 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
1012 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
1013 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
1014 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1015 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 7), 5);
1016 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 0), 0);
1017
1018 let b: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<_, i32> = [1, 3, 3, 3, 7]
1019 .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().()
1020 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
1021 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(i, x)| (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().100, x))
1022 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1023 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 0), 0);
1024 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 1), 0);
1025 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 2), 1);
1026 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 3), 1);
1027 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 4), 4);
1028 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 5), 4);
1029 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 6), 4);
1030 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 7), 4);
1031 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b.partition_pointrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]partition_point().(|_, &x| x <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). 8), 5);
1032 }
1033
1034 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1035 fn disjoint_mut_empty_maprust-analyzer cargo ordermap 1.2.0 map/tests/disjoint_mut_empty_map().() {
1036 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<u32, u32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::defaultrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][Default]default().();
1037 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1038 map.get_disjoint_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_mut().([&0, &1, &2, &3]),
1039 [Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#]
1040 );
1041 }
1042
1043 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1044 fn disjoint_mut_empty_paramrust-analyzer cargo ordermap 1.2.0 map/tests/disjoint_mut_empty_param().() {
1045 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<u32, u32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::defaultrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][Default]default().();
1046 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, 10);
1047 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.get_disjoint_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_mut().([] as [&u32; 0]), []);
1048 }
1049
1050 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1051 fn disjoint_mut_single_failrust-analyzer cargo ordermap 1.2.0 map/tests/disjoint_mut_single_fail().() {
1052 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<u32, u32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::defaultrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][Default]default().();
1053 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, 10);
1054 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.get_disjoint_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_mut().([&0]), [Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#]);
1055 }
1056
1057 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1058 fn disjoint_mut_single_successrust-analyzer cargo ordermap 1.2.0 map/tests/disjoint_mut_single_success().() {
1059 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<u32, u32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::defaultrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][Default]default().();
1060 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, 10);
1061 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.get_disjoint_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_mut().([&1]), [Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 10)]);
1062 }
1063
1064 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1065 fn disjoint_mut_multi_successrust-analyzer cargo ordermap 1.2.0 map/tests/disjoint_mut_multi_success().() {
1066 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<u32, u32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::defaultrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][Default]default().();
1067 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, 100);
1068 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(2, 200);
1069 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(3, 300);
1070 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(4, 400);
1071 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1072 map.get_disjoint_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_mut().([&1, &2]),
1073 [Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 100), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 200)]
1074 );
1075 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1076 map.get_disjoint_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_mut().([&1, &3]),
1077 [Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 100), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 300)]
1078 );
1079 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1080 map.get_disjoint_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_mut().([&3, &1, &4, &2]),
1081 [
1082 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 300),
1083 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 100),
1084 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 400),
1085 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 200)
1086 ]
1087 );
1088 }
1089
1090 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1091 fn disjoint_mut_multi_success_unsized_keyrust-analyzer cargo ordermap 1.2.0 map/tests/disjoint_mut_multi_success_unsized_key().() {
1092 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<&'static str, u32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::defaultrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][Default]default().();
1093 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().("1", 100);
1094 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().("2", 200);
1095 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().("3", 300);
1096 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().("4", 400);
1097
1098 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1099 map.get_disjoint_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_mut().(["1", "2"]),
1100 [Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 100), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 200)]
1101 );
1102 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1103 map.get_disjoint_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_mut().(["1", "3"]),
1104 [Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 100), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 300)]
1105 );
1106 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1107 map.get_disjoint_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_mut().(["3", "1", "4", "2"]),
1108 [
1109 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 300),
1110 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 100),
1111 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 400),
1112 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 200)
1113 ]
1114 );
1115 }
1116
1117 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1118 fn disjoint_mut_multi_success_borrow_keyrust-analyzer cargo ordermap 1.2.0 map/tests/disjoint_mut_multi_success_borrow_key().() {
1119 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, u32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::defaultrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][Default]default().();
1120 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().("1".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), 100);
1121 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().("2".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), 200);
1122 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().("3".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), 300);
1123 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().("4".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), 400);
1124
1125 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1126 map.get_disjoint_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_mut().(["1", "2"]),
1127 [Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 100), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 200)]
1128 );
1129 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1130 map.get_disjoint_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_mut().(["1", "3"]),
1131 [Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 100), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 300)]
1132 );
1133 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1134 map.get_disjoint_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_mut().(["3", "1", "4", "2"]),
1135 [
1136 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 300),
1137 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 100),
1138 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 400),
1139 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 200)
1140 ]
1141 );
1142 }
1143
1144 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1145 fn disjoint_mut_multi_fail_missingrust-analyzer cargo ordermap 1.2.0 map/tests/disjoint_mut_multi_fail_missing().() {
1146 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<u32, u32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::defaultrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][Default]default().();
1147 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, 100);
1148 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(2, 200);
1149 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(3, 300);
1150 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(4, 400);
1151
1152 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.get_disjoint_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_mut().([&1, &5]), [Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 100), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#]);
1153 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.get_disjoint_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_mut().([&5, &6]), [Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#]);
1154 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1155 map.get_disjoint_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_mut().([&1, &5, &4]),
1156 [Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 100), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&mut 400)]
1157 );
1158 }
1159
1160 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1161 #[should_panic]
1162 fn disjoint_mut_multi_fail_duplicate_panicrust-analyzer cargo ordermap 1.2.0 map/tests/disjoint_mut_multi_fail_duplicate_panic().() {
1163 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<u32, u32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::defaultrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][Default]default().();
1164 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, 100);
1165 map.get_disjoint_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_mut().([&1, &2, &1]);
1166 }
1167
1168 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1169 fn disjoint_indices_mut_fail_oobrust-analyzer cargo ordermap 1.2.0 map/tests/disjoint_indices_mut_fail_oob().() {
1170 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<u32, u32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::defaultrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][Default]default().();
1171 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, 10);
1172 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(321, 20);
1173 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1174 map.get_disjoint_indices_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_indices_mut().([1, 3]),
1175 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(craterust-analyzer cargo ordermap 1.2.0 crate/::GetDisjointMutErrorrust-analyzer cargo indexmap 2.14.0 GetDisjointMutError#::IndexOutOfBoundsrust-analyzer cargo indexmap 2.14.0 GetDisjointMutError#IndexOutOfBounds#)
1176 );
1177 }
1178
1179 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1180 fn disjoint_indices_mut_emptyrust-analyzer cargo ordermap 1.2.0 map/tests/disjoint_indices_mut_empty().() {
1181 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<u32, u32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::defaultrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][Default]default().();
1182 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, 10);
1183 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(321, 20);
1184 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.get_disjoint_indices_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_indices_mut().([]), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#([]));
1185 }
1186
1187 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1188 fn disjoint_indices_mut_successrust-analyzer cargo ordermap 1.2.0 map/tests/disjoint_indices_mut_success().() {
1189 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<u32, u32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::defaultrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][Default]default().();
1190 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, 10);
1191 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(321, 20);
1192 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.get_disjoint_indices_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_indices_mut().([0]), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#([(&1, &mut 10)]));
1193
1194 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.get_disjoint_indices_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_indices_mut().([1]), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#([(&321, &mut 20)]));
1195 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1196 map.get_disjoint_indices_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_indices_mut().([0, 1]),
1197 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#([(&1, &mut 10), (&321, &mut 20)])
1198 );
1199 }
1200
1201 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1202 fn disjoint_indices_mut_fail_duplicaterust-analyzer cargo ordermap 1.2.0 map/tests/disjoint_indices_mut_fail_duplicate().() {
1203 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<u32, u32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::defaultrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][Default]default().();
1204 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, 10);
1205 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(321, 20);
1206 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1207 map.get_disjoint_indices_mutrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]get_disjoint_indices_mut().([1, 0, 1]),
1208 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(craterust-analyzer cargo ordermap 1.2.0 crate/::GetDisjointMutErrorrust-analyzer cargo indexmap 2.14.0 GetDisjointMutError#::OverlappingIndicesrust-analyzer cargo indexmap 2.14.0 GetDisjointMutError#OverlappingIndices#)
1209 );
1210 }
1211
1212 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1213 fn insert_sorted_by_keyrust-analyzer cargo ordermap 1.2.0 map/tests/insert_sorted_by_key().() {
1214 let mut values = [(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1, 8), (3, 18), (-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().27, 2), (-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().2, 5)];
1215 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
1216 for (key, value) in values {
1217 let (_, old) = map.insert_sorted_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert_sorted_by_key().(key, value, |k, _| k.absrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]abs().());
1218 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(old, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
1219 }
1220 values.sort_by_keyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]sort_by_key().(|(key, _)| key.absrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]abs().());
1221 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(values, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().map.as_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_slice().());
1222
1223 for (key, value) in &mut values {
1224 let (_, old) = map.insert_sorted_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert_sorted_by_key().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().key, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value, |k, _| k.absrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]abs().());
1225 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(old, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value));
1226 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value = -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value;
1227 }
1228 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(values, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().map.as_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_slice().());
1229 }
1230
1231 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1232 fn insert_sorted_byrust-analyzer cargo ordermap 1.2.0 map/tests/insert_sorted_by().() {
1233 let mut values = [(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)];
1234 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
1235 for (key, value) in values {
1236 let (_, old) = map.insert_sorted_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert_sorted_by().(key, value, |key1, _, key2, _| key2.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(key1));
1237 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(old, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
1238 }
1239 values.reverserust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]reverse().();
1240 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(values, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().map.as_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_slice().());
1241
1242 for (key, value) in &mut values {
1243 let (_, old) = map.insert_sorted_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert_sorted_by().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().key, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value, |key1, _, key2, _| key2.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(key1));
1244 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(old, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value));
1245 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value = -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value;
1246 }
1247 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(values, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().map.as_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_slice().());
1248 }
1249
1250 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1251 fn is_sortedrust-analyzer cargo ordermap 1.2.0 map/tests/is_sorted().() {
1252 fn expectrust-analyzer cargo ordermap 1.2.0 map/tests/expect().(map: &OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32>, e: [bool; 7]) {
1253 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., map.is_sortedrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]is_sorted().());
1254 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., map.is_sorted_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]is_sorted_by().(|k1, _, k2, _| k1 <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]lt(). k2));
1255 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., map.is_sorted_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]is_sorted_by().(|k1, _, k2, _| k1 >rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]gt(). k2));
1256 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., map.is_sorted_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]is_sorted_by().(|_, v1, _, v2| v1 <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]lt(). v2));
1257 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., map.is_sorted_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]is_sorted_by().(|_, v1, _, v2| v1 >rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]gt(). v2));
1258 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().5]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., map.is_sorted_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]is_sorted_by_key().(|k, _| k));
1259 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().6]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., map.is_sorted_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]is_sorted_by_key().(|_, v| v));
1260 }
1261
1262 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::from_iterrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`FromIterator<(K, V)>`]from_iter().((0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|i| (i, i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Mul<Self>`]mul().i)));
1263 expectrust-analyzer cargo ordermap 1.2.0 map/tests/expect().(&map, [true, true, false, true, false, true, true]);
1264
1265 map[rust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`IndexMut<usize>`]index_mut().5]rust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`IndexMut<usize>`]index_mut(). = -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1;
1266 expectrust-analyzer cargo ordermap 1.2.0 map/tests/expect().(&map, [true, true, false, false, false, true, false]);
1267
1268 map[rust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`IndexMut<usize>`]index_mut().5]rust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`IndexMut<usize>`]index_mut(). = 25;
1269 map.replace_indexrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]replace_index().(5, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1270 expectrust-analyzer cargo ordermap 1.2.0 map/tests/expect().(&map, [false, false, false, true, false, false, true]);
1271 }
1272
1273 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1274 fn is_sorted_trivialrust-analyzer cargo ordermap 1.2.0 map/tests/is_sorted_trivial().() {
1275 fn expectrust-analyzer cargo ordermap 1.2.0 map/tests/expect().(map: &OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32>, e: [bool; 5]) {
1276 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., map.is_sortedrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]is_sorted().());
1277 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., map.is_sorted_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]is_sorted_by().(|_, _, _, _| true));
1278 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., map.is_sorted_byrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]is_sorted_by().(|_, _, _, _| false));
1279 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., map.is_sorted_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]is_sorted_by_key().(|_, _| 0f64));
1280 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(e[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()., map.is_sorted_by_keyrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]is_sorted_by_key().(|_, _| f64::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]NAN.));
1281 }
1282
1283 let mut map = OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#::newrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V>`]new().();
1284 expectrust-analyzer cargo ordermap 1.2.0 map/tests/expect().(&map, [true, true, true, true, true]);
1285
1286 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(0, 0);
1287 expectrust-analyzer cargo ordermap 1.2.0 map/tests/expect().(&map, [true, true, true, true, true]);
1288
1289 map.insertrust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]insert().(1, 1);
1290 expectrust-analyzer cargo ordermap 1.2.0 map/tests/expect().(&map, [true, true, false, true, false]);
1291
1292 map.reverserust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]reverse().();
1293 expectrust-analyzer cargo ordermap 1.2.0 map/tests/expect().(&map, [false, true, false, true, false]);
1294 }