Debian Codegraph @

src/map/slice.rs

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 use superrust-analyzer cargo ordermap 1.2.0 map/::OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#;
2 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::{selfrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/, Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#, Indexrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#, IndexMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#};
3 use indexmaprust-analyzer cargo indexmap 2.14.0 crate/::maprust-analyzer cargo indexmap 2.14.0 map/::Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#;
4
5 // We can't have `impl<I: RangeBounds<usize>> Index<I>` because that conflicts
6 // both upstream with `Index<usize>` and downstream with `Index<&Q>`.
7 // Instead, we repeat the implementations for all the core range types.
8 macro_rules! impl_indexrust-analyzer cargo ordermap 1.2.0 map/slice/impl_index! {
9 ($($range:ty),*) => {$(
10 impl<K, V, S> Index<$range> for OrderMap<K, V, S> {
11 type Output = Slice<K, V>;
12
13 fn index(&self, range: $range) -> &Self::Output {
14 &self.inner[range]
15 }
16 }
17
18 impl<K, V, S> IndexMut<$range> for OrderMap<K, V, S> {
19 fn index_mut(&mut self, range: $range) -> &mut Self::Output {
20 &mut self.inner[range]
21 }
22 }
23 )*}
24 }
25 impl_indexrust-analyzer cargo ordermap 1.2.0 map/slice/impl_index!!(
26 opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Rangerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#<usize>,
27 opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::RangeFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#<usize>,
28 opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::RangeFullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#,
29 opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<usize>,
30 opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::RangeTorust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#<usize>,
31 opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::RangeToInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeToInclusive#<usize>,
32 (Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#<usize>, Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#<usize>)
33 );
34
•35 #[cfg(all(test, feature = "std"))]
36 mod testsrust-analyzer cargo ordermap 1.2.0 map/slice/tests/ {
37 use superrust-analyzer cargo ordermap 1.2.0 map/slice/::*;
38 use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#;
39
40 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
41 fn slice_indexrust-analyzer cargo ordermap 1.2.0 map/slice/tests/slice_index().() {
42 fn checkrust-analyzer cargo ordermap 1.2.0 map/slice/tests/check().(
43 vec_slice: &[(i32, i32)],
44 map_slice: &Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32>,
45 sub_slice: &Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32>,
46 ) {
47 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map_slice as *const _, sub_slice as *const _);
48 itertoolsrust-analyzer cargo itertools 0.14.0 crate/::assert_equalrust-analyzer cargo itertools 0.14.0 assert_equal().(
49 vec_slice.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().(),
50 map_slice.iterrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(&k, &v)| (k, v)),
51 );
52 itertoolsrust-analyzer cargo itertools 0.14.0 crate/::assert_equalrust-analyzer cargo itertools 0.14.0 assert_equal().(vec_slice.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(k, _)| k), map_slice.keysrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]keys().());
53 itertoolsrust-analyzer cargo itertools 0.14.0 crate/::assert_equalrust-analyzer cargo itertools 0.14.0 assert_equal().(vec_slice.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(_, v)| v), map_slice.valuesrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]values().());
54 }
55
56 let vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(i32, i32)> = (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)).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
57 let map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = vec.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
58 let slice = map.as_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_slice().();
59
60 // RangeFull
61 checkrust-analyzer cargo ordermap 1.2.0 map/slice/tests/check().(&vec[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., &map[rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`Index<ops::RangeFull>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`Index<ops::RangeFull>`]index()., &slice[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
62
63 for i in 0usize..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10 {
64 // Index
65 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(vec[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..1, map[rust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`Index<usize>`]index().i]rust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`Index<usize>`]index().);
66 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(vec[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..1, slice[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
67 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().&(i as i32)]rust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`Index<&Q>`]index()., map[rust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`Index<usize>`]index().i]rust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`Index<usize>`]index().);
68 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().&(i as i32)]rust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`Index<&Q>`]index()., slice[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
69
70 // RangeFrom
71 checkrust-analyzer cargo ordermap 1.2.0 map/slice/tests/check().(&vec[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., &map[rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`Index<ops::RangeFrom<usize>>`]index().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`Index<ops::RangeFrom<usize>>`]index()., &slice[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i..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 ops/index/Index#index().);
72
73 // RangeTo
74 checkrust-analyzer cargo ordermap 1.2.0 map/slice/tests/check().(&vec[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., &map[rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`Index<ops::RangeTo<usize>>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#i]rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`Index<ops::RangeTo<usize>>`]index()., &slice[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
75
76 // RangeToInclusive
77 checkrust-analyzer cargo ordermap 1.2.0 map/slice/tests/check().(&vec[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeToInclusive#i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., &map[rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`Index<ops::RangeToInclusive<usize>>`]index()...=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeToInclusive#i]rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`Index<ops::RangeToInclusive<usize>>`]index()., &slice[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeToInclusive#i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
78
79 // (Bound<usize>, Bound<usize>)
80 let bounds = (Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Excludedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Excluded#(i), Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Unboundedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Unbounded#);
81 checkrust-analyzer cargo ordermap 1.2.0 map/slice/tests/check().(&vec[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().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().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., &map[rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`Index<(Bound<usize>, Bound<usize>)>`]index().bounds]rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`Index<(Bound<usize>, Bound<usize>)>`]index()., &slice[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().bounds]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
82
83 for j in i..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#10 {
84 // Range
85 checkrust-analyzer cargo ordermap 1.2.0 map/slice/tests/check().(&vec[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#j]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., &map[rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`Index<ops::Range<usize>>`]index().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#j]rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`Index<ops::Range<usize>>`]index()., &slice[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#j]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
86 }
87
88 for j in i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10 {
89 // RangeInclusive
90 checkrust-analyzer cargo ordermap 1.2.0 map/slice/tests/check().(&vec[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().i..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#j]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., &map[rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`Index<ops::RangeInclusive<usize>>`]index().i..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#j]rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`Index<ops::RangeInclusive<usize>>`]index()., &slice[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#j]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
91 }
92 }
93 }
94
95 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
96 fn slice_index_mutrust-analyzer cargo ordermap 1.2.0 map/slice/tests/slice_index_mut().() {
97 fn check_mutrust-analyzer cargo ordermap 1.2.0 map/slice/tests/check_mut().(
98 vec_slice: &[(i32, i32)],
99 map_slice: &mut Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32>,
100 sub_slice: &mut Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32>,
101 ) {
102 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map_slice, sub_slice);
103 itertoolsrust-analyzer cargo itertools 0.14.0 crate/::assert_equalrust-analyzer cargo itertools 0.14.0 assert_equal().(
104 vec_slice.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().(),
105 map_slice.iter_mutrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]iter_mut().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(&k, &mut v)| (k, v)),
106 );
107 itertoolsrust-analyzer cargo itertools 0.14.0 crate/::assert_equalrust-analyzer cargo itertools 0.14.0 assert_equal().(
108 vec_slice.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|&(_, v)| v),
109 map_slice.values_mutrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]values_mut().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|&mut v| v),
110 );
111 }
112
113 let vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(i32, i32)> = (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)).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
114 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = vec.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
115 let mut map2 = map.clonerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][Clone]clone().();
116 let slice = map2.as_mut_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_mut_slice().();
117
118 // RangeFull
119 check_mutrust-analyzer cargo ordermap 1.2.0 map/slice/tests/check_mut().(&vec[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., &mut map[rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`IndexMut<ops::RangeFull>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`IndexMut<ops::RangeFull>`]index_mut()., &mut slice[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/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().);
120
121 for i in 0usize..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10 {
122 // IndexMut
123 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&mut map[rust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`IndexMut<usize>`]index_mut().i]rust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`][`IndexMut<usize>`]index_mut()., &mut 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().);
124
125 // RangeFrom
126 check_mutrust-analyzer cargo ordermap 1.2.0 map/slice/tests/check_mut().(&vec[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., &mut map[rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`IndexMut<ops::RangeFrom<usize>>`]index_mut().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`IndexMut<ops::RangeFrom<usize>>`]index_mut()., &mut 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/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().);
127
128 // RangeTo
129 check_mutrust-analyzer cargo ordermap 1.2.0 map/slice/tests/check_mut().(&vec[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., &mut map[rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`IndexMut<ops::RangeTo<usize>>`]index_mut()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#i]rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`IndexMut<ops::RangeTo<usize>>`]index_mut()., &mut slice[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/range/RangeTo#i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().);
130
131 // RangeToInclusive
132 check_mutrust-analyzer cargo ordermap 1.2.0 map/slice/tests/check_mut().(&vec[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeToInclusive#i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., &mut map[rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`IndexMut<ops::RangeToInclusive<usize>>`]index_mut()...=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeToInclusive#i]rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`IndexMut<ops::RangeToInclusive<usize>>`]index_mut()., &mut slice[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/range/RangeToInclusive#i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().);
133
134 // (Bound<usize>, Bound<usize>)
135 let bounds = (Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Excludedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Excluded#(i), Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Unboundedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Unbounded#);
136 check_mutrust-analyzer cargo ordermap 1.2.0 map/slice/tests/check_mut().(&vec[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().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().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., &mut map[rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`IndexMut<(Bound<usize>, Bound<usize>)>`]index_mut().bounds]rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`IndexMut<(Bound<usize>, Bound<usize>)>`]index_mut()., &mut slice[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().bounds]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().);
137
138 for j in i..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#10 {
139 // Range
140 check_mutrust-analyzer cargo ordermap 1.2.0 map/slice/tests/check_mut().(&vec[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#j]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., &mut map[rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`IndexMut<ops::Range<usize>>`]index_mut().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#j]rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`IndexMut<ops::Range<usize>>`]index_mut()., &mut 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/range/Range#j]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().);
141 }
142
143 for j in i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10 {
144 // RangeInclusive
145 check_mutrust-analyzer cargo ordermap 1.2.0 map/slice/tests/check_mut().(&vec[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().i..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#j]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., &mut map[rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`IndexMut<ops::RangeInclusive<usize>>`]index_mut().i..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#j]rust-analyzer cargo ordermap 1.2.0 map/slice/impl#[`OrderMap<K, V, S>`][`IndexMut<ops::RangeInclusive<usize>>`]index_mut()., &mut 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/range/RangeInclusive#j]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/IndexMut#index_mut().);
146 }
147 }
148 }
149
150 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
151 fn slice_newrust-analyzer cargo ordermap 1.2.0 map/slice/tests/slice_new().() {
152 let slice: &Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32> = Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#::newrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]new().();
153 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(slice.is_emptyrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]is_empty().());
154 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().(), 0);
155 }
156
157 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
158 fn slice_new_mutrust-analyzer cargo ordermap 1.2.0 map/slice/tests/slice_new_mut().() {
159 let slice: &mut Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32> = Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#::new_mutrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]new_mut().();
160 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(slice.is_emptyrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]is_empty().());
161 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().(), 0);
162 }
163
164 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
165 fn slice_get_index_mutrust-analyzer cargo ordermap 1.2.0 map/slice/tests/slice_get_index_mut().() {
166 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = (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)).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
167 let slice: &mut Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32> = map.as_mut_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_mut_slice().();
168
169 {
170 let (key, value) = slice.get_index_mutrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]get_index_mut().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
171 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().key, 0);
172 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, 0);
173
174 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value = 11;
175 }
176
177 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(slice[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., 11);
178
179 {
180 let result = slice.get_index_mutrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]get_index_mut().(11);
181 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().());
182 }
183 }
184
185 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
186 fn slice_split_firstrust-analyzer cargo ordermap 1.2.0 map/slice/tests/slice_split_first().() {
187 let slice: &mut Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32> = Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#::new_mutrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]new_mut().();
188 let result = slice.split_firstrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]split_first().();
189 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().());
190
191 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = (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)).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
192 let slice: &mut Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32> = map.as_mut_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_mut_slice().();
193
194 {
195 let (first, rest) = slice.split_firstrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]split_first().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
196 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(first, (&0, &0));
197 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(rest.lenrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]len().(), 9);
198 }
199 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().(), 10);
200 }
201
202 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
203 fn slice_split_first_mutrust-analyzer cargo ordermap 1.2.0 map/slice/tests/slice_split_first_mut().() {
204 let slice: &mut Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32> = Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#::new_mutrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]new_mut().();
205 let result = slice.split_first_mutrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]split_first_mut().();
206 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().());
207
208 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = (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)).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
209 let slice: &mut Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32> = map.as_mut_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_mut_slice().();
210
211 {
212 let (first, rest) = slice.split_first_mutrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]split_first_mut().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
213 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(first, (&0, &mut 0));
214 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(rest.lenrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]len().(), 9);
215
216 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().first.1 = 11;
217 }
218 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().(), 10);
219 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(slice[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., 11);
220 }
221
222 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
223 fn slice_split_lastrust-analyzer cargo ordermap 1.2.0 map/slice/tests/slice_split_last().() {
224 let slice: &mut Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32> = Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#::new_mutrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]new_mut().();
225 let result = slice.split_lastrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]split_last().();
226 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().());
227
228 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = (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)).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
229 let slice: &mut Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32> = map.as_mut_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_mut_slice().();
230
231 {
232 let (last, rest) = slice.split_lastrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]split_last().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
233 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(last, (&9, &81));
234 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(rest.lenrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]len().(), 9);
235 }
236 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().(), 10);
237 }
238
239 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
240 fn slice_split_last_mutrust-analyzer cargo ordermap 1.2.0 map/slice/tests/slice_split_last_mut().() {
241 let slice: &mut Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32> = Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#::new_mutrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]new_mut().();
242 let result = slice.split_last_mutrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]split_last_mut().();
243 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().());
244
245 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = (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)).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
246 let slice: &mut Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32> = map.as_mut_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_mut_slice().();
247
248 {
249 let (last, rest) = slice.split_last_mutrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]split_last_mut().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
250 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(last, (&9, &mut 81));
251 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(rest.lenrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]len().(), 9);
252
253 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().last.1 = 100;
254 }
255
256 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().(), 10);
257 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(slice[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().slice.lenrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]len().() -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). 1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., 100);
258 }
259
260 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
261 fn slice_get_rangerust-analyzer cargo ordermap 1.2.0 map/slice/tests/slice_get_range().() {
262 let mut map: OrderMaprust-analyzer cargo ordermap 1.2.0 map/OrderMap#<i32, i32> = (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)).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
263 let slice: &mut Slicerust-analyzer cargo indexmap 2.14.0 map/slice/Slice#<i32, i32> = map.as_mut_slicerust-analyzer cargo ordermap 1.2.0 map/impl#[`OrderMap<K, V, S>`]as_mut_slice().();
264 let subslice = slice.get_rangerust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]get_range().(3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
265 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(subslice.lenrust-analyzer cargo indexmap 2.14.0 map/slice/impl#[`Slice<K, V>`]len().(), 3);
266 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(subslice, &[(3, 9), (4, 16), (5, 25)]);
267 }
268 }