| 1 | use superrust-analyzer cargo ordermap 1.2.0 set/::*; |
| 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 set/tests/it_works().() { |
| 7 | let mut set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 8 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.is_emptyrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_empty().(), true); |
| 9 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(1); |
| 10 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(1); |
| 11 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 1); |
| 12 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set.getrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, 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!!(set.is_emptyrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, 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 set/tests/new().() { |
| 18 | let set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 19 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?}", set); |
| 20 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]capacity().(), 0); |
| 21 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 0); |
| 22 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.is_emptyrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, 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 set/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 set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::with_capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]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!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), i); |
| 33 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(elt); |
| 34 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, 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!!(set.getrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get().(&elt), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&elt)); |
| 36 | } |
| 37 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?}", set); |
| 38 | |
| 39 | for &elt in ¬_present { |
| 40 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set.getrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get().(&elt).is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().()); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 45 | fn insert_fullrust-analyzer cargo ordermap 1.2.0 set/tests/insert_full().() { |
| 46 | let insert = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![9, 2, 7, 1, 4, 6, 13]; |
| 47 | let present = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1, 6, 2]; |
| 48 | let mut set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::with_capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]with_capacity().(insert.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()); |
| 49 | |
| 50 | 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().() { |
| 51 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), i); |
| 52 | let (index, success) = set.insert_fullrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert_full().(elt); |
| 53 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(success); |
| 54 | 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), set.get_fullrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get_full().(&elt).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|x| x.0)); |
| 55 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), i +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1); |
| 56 | } |
| 57 | |
| 58 | let len = set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(); |
| 59 | for &elt in &present { |
| 60 | let (index, success) = set.insert_fullrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert_full().(elt); |
| 61 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().success); |
| 62 | 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), set.get_fullrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get_full().(&elt).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|x| x.0)); |
| 63 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), len); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 68 | fn insert_2rust-analyzer cargo ordermap 1.2.0 set/tests/insert_2().() { |
| 69 | let mut set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::with_capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]with_capacity().(16); |
| 70 | |
| 71 | let mut values = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 72 | values.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); |
| 73 | values.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 }); |
| 74 | |
| 75 | for &i in &values { |
| 76 | let old_set = set.clonerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`][Clone]clone().(); |
| 77 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(i); |
| 78 | for value in old_set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().() { |
| 79 | if set.getrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get().(value).is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() { |
| 80 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("old_set: {:?}", old_set); |
| 81 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("set: {:?}", set); |
| 82 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("did not find {} in set", value); |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | for &i in &values { |
| 88 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set.getrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, 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); |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 93 | fn insert_duprust-analyzer cargo ordermap 1.2.0 set/tests/insert_dup().() { |
| 94 | let mut elements = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0, 2, 4, 6, 8]; |
| 95 | let mut set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<u8> = elements.drainrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]drain().(..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 96 | { |
| 97 | let (i, v) = set.get_fullrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get_full().(&0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 98 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 5); |
| 99 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(i, 0); |
| 100 | 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().v, 0); |
| 101 | } |
| 102 | { |
| 103 | let inserted = set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(0); |
| 104 | let (i, v) = set.get_fullrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get_full().(&0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 105 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 5); |
| 106 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(inserted, false); |
| 107 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(i, 0); |
| 108 | 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().v, 0); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 113 | fn insert_orderrust-analyzer cargo ordermap 1.2.0 set/tests/insert_order().() { |
| 114 | let insert = [0, 4, 2, 12, 8, 7, 11, 5, 3, 17, 19, 22, 23]; |
| 115 | let mut set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 116 | |
| 117 | for &elt in &insert { |
| 118 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(elt); |
| 119 | } |
| 120 | |
| 121 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().().countrust-analyzer cargo indexmap 2.14.0 set/iter/impl#[`Iter<'a, T>`][Iterator]count().(), set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().()); |
| 122 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().().countrust-analyzer cargo indexmap 2.14.0 set/iter/impl#[`Iter<'a, T>`][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().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().()) { |
| 124 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a, b); |
| 125 | } |
| 126 | for (i, v) 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().(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().()) { |
| 127 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.get_indexrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get_index().(i).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), v); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 132 | fn shift_insertrust-analyzer cargo ordermap 1.2.0 set/tests/shift_insert().() { |
| 133 | let insert = [0, 4, 2, 12, 8, 7, 11, 5, 3, 17, 19, 22, 23]; |
| 134 | let mut set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 135 | |
| 136 | for &elt in &insert { |
| 137 | set.shift_insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]shift_insert().(0, elt); |
| 138 | } |
| 139 | |
| 140 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().().countrust-analyzer cargo indexmap 2.14.0 set/iter/impl#[`Iter<'a, T>`][Iterator]count().(), set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().()); |
| 141 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().().countrust-analyzer cargo indexmap 2.14.0 set/iter/impl#[`Iter<'a, T>`][Iterator]count().(), insert.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()); |
| 142 | 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().(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().()) { |
| 143 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a, b); |
| 144 | } |
| 145 | for (i, v) 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().(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().()) { |
| 146 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.get_indexrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get_index().(i).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), v); |
| 147 | } |
| 148 | |
| 149 | // "insert" that moves an existing entry |
| 150 | set.shift_insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, 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().); |
| 151 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().().countrust-analyzer cargo indexmap 2.14.0 set/iter/impl#[`Iter<'a, T>`][Iterator]count().(), insert.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()); |
| 152 | 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()., set[rust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`][`Index<usize>`]index().0]rust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`][`Index<usize>`]index().); |
| 153 | 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().(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().().skiprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#skip().(1)) { |
| 154 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a, b); |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 159 | fn replacerust-analyzer cargo ordermap 1.2.0 set/tests/replace().() { |
| 160 | let replace = [0, 4, 2, 12, 8, 7, 11, 5]; |
| 161 | let not_present = [1, 3, 6, 9, 10]; |
| 162 | let mut set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::with_capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]with_capacity().(replace.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()); |
| 163 | |
| 164 | for (i, &elt) in replace.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().() { |
| 165 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), i); |
| 166 | set.replacerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]replace().(elt); |
| 167 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), i +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1); |
| 168 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.getrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get().(&elt), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&elt)); |
| 169 | } |
| 170 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?}", set); |
| 171 | |
| 172 | for &elt in ¬_present { |
| 173 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set.getrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get().(&elt).is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().()); |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 178 | fn replace_fullrust-analyzer cargo ordermap 1.2.0 set/tests/replace_full().() { |
| 179 | let replace = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![9, 2, 7, 1, 4, 6, 13]; |
| 180 | let present = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1, 6, 2]; |
| 181 | let mut set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::with_capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]with_capacity().(replace.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()); |
| 182 | |
| 183 | for (i, &elt) in replace.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().() { |
| 184 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), i); |
| 185 | let (index, replaced) = set.replace_fullrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]replace_full().(elt); |
| 186 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(replaced.is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().()); |
| 187 | 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), set.get_fullrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get_full().(&elt).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|x| x.0)); |
| 188 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), i +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1); |
| 189 | } |
| 190 | |
| 191 | let len = set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(); |
| 192 | for &elt in &present { |
| 193 | let (index, replaced) = set.replace_fullrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]replace_full().(elt); |
| 194 | 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#(elt), replaced); |
| 195 | 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), set.get_fullrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get_full().(&elt).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|x| x.0)); |
| 196 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), len); |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 201 | fn replace_2rust-analyzer cargo ordermap 1.2.0 set/tests/replace_2().() { |
| 202 | let mut set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::with_capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]with_capacity().(16); |
| 203 | |
| 204 | let mut values = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 205 | values.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); |
| 206 | values.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 }); |
| 207 | |
| 208 | for &i in &values { |
| 209 | let old_set = set.clonerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`][Clone]clone().(); |
| 210 | set.replacerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]replace().(i); |
| 211 | for value in old_set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().() { |
| 212 | if set.getrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get().(value).is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() { |
| 213 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("old_set: {:?}", old_set); |
| 214 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("set: {:?}", set); |
| 215 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("did not find {} in set", value); |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | for &i in &values { |
| 221 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set.getrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, 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); |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 226 | fn replace_duprust-analyzer cargo ordermap 1.2.0 set/tests/replace_dup().() { |
| 227 | let mut elements = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0, 2, 4, 6, 8]; |
| 228 | let mut set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<u8> = elements.drainrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]drain().(..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 229 | { |
| 230 | let (i, v) = set.get_fullrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get_full().(&0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 231 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 5); |
| 232 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(i, 0); |
| 233 | 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().v, 0); |
| 234 | } |
| 235 | { |
| 236 | let replaced = set.replacerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]replace().(0); |
| 237 | let (i, v) = set.get_fullrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get_full().(&0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 238 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 5); |
| 239 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(replaced, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(0)); |
| 240 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(i, 0); |
| 241 | 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().v, 0); |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 246 | fn replace_orderrust-analyzer cargo ordermap 1.2.0 set/tests/replace_order().() { |
| 247 | let replace = [0, 4, 2, 12, 8, 7, 11, 5, 3, 17, 19, 22, 23]; |
| 248 | let mut set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 249 | |
| 250 | for &elt in &replace { |
| 251 | set.replacerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]replace().(elt); |
| 252 | } |
| 253 | |
| 254 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().().countrust-analyzer cargo indexmap 2.14.0 set/iter/impl#[`Iter<'a, T>`][Iterator]count().(), set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().()); |
| 255 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().().countrust-analyzer cargo indexmap 2.14.0 set/iter/impl#[`Iter<'a, T>`][Iterator]count().(), replace.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()); |
| 256 | for (a, b) in replace.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().(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().()) { |
| 257 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a, b); |
| 258 | } |
| 259 | for (i, v) in (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#replace.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().(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().()) { |
| 260 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.get_indexrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get_index().(i).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), v); |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 265 | fn replace_changerust-analyzer cargo ordermap 1.2.0 set/tests/replace_change().() { |
| 266 | // Check pointers to make sure it really changes |
| 267 | let mut set = ordersetrust-analyzer cargo ordermap 1.2.0 macros/orderset!!(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![42]); |
| 268 | let old_ptr = set[rust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`][`Index<usize>`]index().0]rust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`][`Index<usize>`]index()..as_ptrrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_ptr().(); |
| 269 | let new = set[rust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`][`Index<usize>`]index().0]rust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`][`Index<usize>`]index()..clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().(); |
| 270 | let new_ptr = new.as_ptrrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_ptr().(); |
| 271 | assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(old_ptr, new_ptr); |
| 272 | let replaced = set.replacerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]replace().(new).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 273 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(replaced.as_ptrrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_ptr().(), old_ptr); |
| 274 | } |
| 275 | |
| 276 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 277 | fn growrust-analyzer cargo ordermap 1.2.0 set/tests/grow().() { |
| 278 | let insert = [0, 4, 2, 12, 8, 7, 11]; |
| 279 | let not_present = [1, 3, 6, 9, 10]; |
| 280 | let mut set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::with_capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]with_capacity().(insert.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()); |
| 281 | |
| 282 | 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().() { |
| 283 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), i); |
| 284 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(elt); |
| 285 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), i +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1); |
| 286 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.getrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get().(&elt), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&elt)); |
| 287 | } |
| 288 | |
| 289 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?}", set); |
| 290 | for &elt in &insert { |
| 291 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, 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); |
| 292 | } |
| 293 | for &elt in &insert { |
| 294 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, 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); |
| 295 | } |
| 296 | 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) { |
| 297 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, 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); |
| 298 | } |
| 299 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?}", set); |
| 300 | for &elt in ¬_present { |
| 301 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set.getrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get().(&elt).is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().()); |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 306 | fn reserverust-analyzer cargo ordermap 1.2.0 set/tests/reserve().() { |
| 307 | let mut set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::<usize>::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 308 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]capacity().(), 0); |
| 309 | set.reserverust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]reserve().(100); |
| 310 | let capacity = set.capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]capacity().(); |
| 311 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(capacity >= 100); |
| 312 | for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#capacity { |
| 313 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), i); |
| 314 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(i); |
| 315 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), i +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1); |
| 316 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]capacity().(), capacity); |
| 317 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.getrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get().(&i), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&i)); |
| 318 | } |
| 319 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(capacity); |
| 320 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), capacity +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1); |
| 321 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set.capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]capacity().() >rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). capacity); |
| 322 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.getrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get().(&capacity), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&capacity)); |
| 323 | } |
| 324 | |
| 325 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 326 | fn try_reserverust-analyzer cargo ordermap 1.2.0 set/tests/try_reserve().() { |
| 327 | let mut set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::<usize>::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 328 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]capacity().(), 0); |
| 329 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.try_reserverust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]try_reserve().(100), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())); |
| 330 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set.capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]capacity().() >= 100); |
| 331 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set.try_reserverust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, 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().()); |
| 332 | } |
| 333 | |
| 334 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 335 | fn shrink_to_fitrust-analyzer cargo ordermap 1.2.0 set/tests/shrink_to_fit().() { |
| 336 | let mut set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::<usize>::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 337 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]capacity().(), 0); |
| 338 | for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#100 { |
| 339 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), i); |
| 340 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(i); |
| 341 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), i +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1); |
| 342 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set.capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]capacity().() >= i +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1); |
| 343 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.getrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get().(&i), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&i)); |
| 344 | set.shrink_to_fitrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]shrink_to_fit().(); |
| 345 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), i +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1); |
| 346 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]capacity().(), i +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1); |
| 347 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.getrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get().(&i), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&i)); |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 352 | fn removerust-analyzer cargo ordermap 1.2.0 set/tests/remove().() { |
| 353 | let insert = [0, 4, 2, 12, 8, 7, 11, 5, 3, 17, 19, 22, 23]; |
| 354 | let mut set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 355 | |
| 356 | for &elt in &insert { |
| 357 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(elt); |
| 358 | } |
| 359 | |
| 360 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().().countrust-analyzer cargo indexmap 2.14.0 set/iter/impl#[`Iter<'a, T>`][Iterator]count().(), set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().()); |
| 361 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().().countrust-analyzer cargo indexmap 2.14.0 set/iter/impl#[`Iter<'a, T>`][Iterator]count().(), insert.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()); |
| 362 | 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().(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().()) { |
| 363 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a, b); |
| 364 | } |
| 365 | |
| 366 | let remove_fail = [99, 77]; |
| 367 | let remove = [4, 12, 8, 7]; |
| 368 | |
| 369 | for &value in &remove_fail { |
| 370 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set.swap_remove_fullrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]swap_remove_full().(&value).is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().()); |
| 371 | } |
| 372 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?}", set); |
| 373 | for &value in &remove { |
| 374 | //println!("{:?}", set); |
| 375 | let index = set.get_fullrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get_full().(&value).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().0; |
| 376 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.swap_remove_fullrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]swap_remove_full().(&value), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((index, value))); |
| 377 | } |
| 378 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?}", set); |
| 379 | |
| 380 | for value in &insert { |
| 381 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.getrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get().(value).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().(value)); |
| 382 | } |
| 383 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, 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().()); |
| 384 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().().countrust-analyzer cargo indexmap 2.14.0 set/iter/impl#[`Iter<'a, T>`][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().()); |
| 385 | } |
| 386 | |
| 387 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 388 | fn swap_remove_indexrust-analyzer cargo ordermap 1.2.0 set/tests/swap_remove_index().() { |
| 389 | let insert = [0, 4, 2, 12, 8, 7, 11, 5, 3, 17, 19, 22, 23]; |
| 390 | let mut set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 391 | |
| 392 | for &elt in &insert { |
| 393 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(elt); |
| 394 | } |
| 395 | |
| 396 | let mut vector = insert.to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().(); |
| 397 | let remove_sequence = &[3, 3, 10, 4, 5, 4, 3, 0, 1]; |
| 398 | |
| 399 | // check that the same swap remove sequence on vec and set |
| 400 | // have the same result. |
| 401 | for &rm in remove_sequence { |
| 402 | 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); |
| 403 | let out_set = set.swap_remove_indexrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]swap_remove_index().(rm).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 404 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(out_vec, out_set); |
| 405 | } |
| 406 | 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().(), set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().()); |
| 407 | 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().(set.iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]iter().()) { |
| 408 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a, b); |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 413 | fn partial_eq_and_eqrust-analyzer cargo ordermap 1.2.0 set/tests/partial_eq_and_eq().() { |
| 414 | let mut set_a = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 415 | set_a.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(1); |
| 416 | set_a.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(2); |
| 417 | let mut set_b = set_a.clonerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`][Clone]clone().(); |
| 418 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set_a, set_b); |
| 419 | set_b.swap_removerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]swap_remove().(&1); |
| 420 | assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(set_a, set_b); |
| 421 | |
| 422 | let set_c: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = set_b.into_iterrust-analyzer cargo ordermap 1.2.0 set/iter/impl#[`OrderSet<T, S>`][IntoIterator]into_iter().().collectrust-analyzer cargo indexmap 2.14.0 set/iter/impl#[`IntoIter<T>`][Iterator]collect().(); |
| 423 | assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(set_a, set_c); |
| 424 | assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(set_c, set_a); |
| 425 | } |
| 426 | |
| 427 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 428 | fn extendrust-analyzer cargo ordermap 1.2.0 set/tests/extend().() { |
| 429 | let mut set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 430 | set.extendrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`][`Extend<&'a T>`]extend().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![&1, &2, &3, &4]); |
| 431 | set.extendrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`][`Extend<T>`]extend().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![5, 6]); |
| 432 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.into_iterrust-analyzer cargo ordermap 1.2.0 set/iter/impl#[`OrderSet<T, S>`][IntoIterator]into_iter().().collectrust-analyzer cargo indexmap 2.14.0 set/iter/impl#[`IntoIter<T>`][Iterator]collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1, 2, 3, 4, 5, 6]); |
| 433 | } |
| 434 | |
| 435 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 436 | fn comparisonsrust-analyzer cargo ordermap 1.2.0 set/tests/comparisons().() { |
| 437 | let set_a: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 438 | let set_b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = (3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 439 | let set_c: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 440 | let set_d: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = (3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#9).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 441 | |
| 442 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().set_a.is_disjointrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_disjoint().(&set_a)); |
| 443 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set_a.is_subsetrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_subset().(&set_a)); |
| 444 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set_a.is_supersetrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_superset().(&set_a)); |
| 445 | |
| 446 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set_a.is_disjointrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_disjoint().(&set_b)); |
| 447 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set_b.is_disjointrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_disjoint().(&set_a)); |
| 448 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().set_a.is_subsetrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_subset().(&set_b)); |
| 449 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().set_b.is_subsetrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_subset().(&set_a)); |
| 450 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().set_a.is_supersetrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_superset().(&set_b)); |
| 451 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().set_b.is_supersetrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_superset().(&set_a)); |
| 452 | |
| 453 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().set_a.is_disjointrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_disjoint().(&set_c)); |
| 454 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().set_c.is_disjointrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_disjoint().(&set_a)); |
| 455 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set_a.is_subsetrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_subset().(&set_c)); |
| 456 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().set_c.is_subsetrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_subset().(&set_a)); |
| 457 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().set_a.is_supersetrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_superset().(&set_c)); |
| 458 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(set_c.is_supersetrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_superset().(&set_a)); |
| 459 | |
| 460 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().set_c.is_disjointrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_disjoint().(&set_d)); |
| 461 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().set_d.is_disjointrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_disjoint().(&set_c)); |
| 462 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().set_c.is_subsetrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_subset().(&set_d)); |
| 463 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().set_d.is_subsetrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_subset().(&set_c)); |
| 464 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().set_c.is_supersetrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_superset().(&set_d)); |
| 465 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().set_d.is_supersetrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_superset().(&set_c)); |
| 466 | } |
| 467 | |
| 468 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 469 | fn iter_comparisonsrust-analyzer cargo ordermap 1.2.0 set/tests/iter_comparisons().() { |
| 470 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/empty/empty().; |
| 471 | |
| 472 | fn checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().<'a, I1, I2>(iter1: I1, iter2: I2) |
| 473 | where |
| 474 | I1: Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = &'a i32>, |
| 475 | I2: Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = i32>, |
| 476 | { |
| 477 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(iter1.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().(iter2)); |
| 478 | } |
| 479 | |
| 480 | let set_a: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 481 | let set_b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = (3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 482 | let set_c: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 483 | let set_d: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = (3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#9).revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 484 | |
| 485 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_a.differencerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]difference().(&set_a), emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/empty/empty().()); |
| 486 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_a.symmetric_differencerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]symmetric_difference().(&set_a), emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/empty/empty().()); |
| 487 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_a.intersectionrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]intersection().(&set_a), 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3); |
| 488 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_a.unionrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]union().(&set_a), 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3); |
| 489 | |
| 490 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_a.differencerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]difference().(&set_b), 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3); |
| 491 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_b.differencerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]difference().(&set_a), 3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6); |
| 492 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_a.symmetric_differencerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]symmetric_difference().(&set_b), 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6); |
| 493 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_b.symmetric_differencerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]symmetric_difference().(&set_a), (3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6).chainrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#chain().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3)); |
| 494 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_a.intersectionrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]intersection().(&set_b), emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/empty/empty().()); |
| 495 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_b.intersectionrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]intersection().(&set_a), emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/empty/empty().()); |
| 496 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_a.unionrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]union().(&set_b), 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6); |
| 497 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_b.unionrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]union().(&set_a), (3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6).chainrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#chain().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3)); |
| 498 | |
| 499 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_a.differencerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]difference().(&set_c), emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/empty/empty().()); |
| 500 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_c.differencerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]difference().(&set_a), 3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6); |
| 501 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_a.symmetric_differencerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]symmetric_difference().(&set_c), 3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6); |
| 502 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_c.symmetric_differencerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]symmetric_difference().(&set_a), 3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6); |
| 503 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_a.intersectionrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]intersection().(&set_c), 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3); |
| 504 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_c.intersectionrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]intersection().(&set_a), 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3); |
| 505 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_a.unionrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]union().(&set_c), 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6); |
| 506 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_c.unionrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]union().(&set_a), 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6); |
| 507 | |
| 508 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_c.differencerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]difference().(&set_d), 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3); |
| 509 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_d.differencerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]difference().(&set_c), (6..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#9).revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().()); |
| 510 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().( |
| 511 | set_c.symmetric_differencerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]symmetric_difference().(&set_d), |
| 512 | (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3).chainrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#chain().((6..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#9).revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().()), |
| 513 | ); |
| 514 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_d.symmetric_differencerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]symmetric_difference().(&set_c), (6..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#9).revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().().chainrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#chain().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3)); |
| 515 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_c.intersectionrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]intersection().(&set_d), 3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6); |
| 516 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_d.intersectionrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]intersection().(&set_c), (3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6).revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().()); |
| 517 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_c.unionrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]union().(&set_d), (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6).chainrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#chain().((6..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#9).revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().())); |
| 518 | checkrust-analyzer cargo ordermap 1.2.0 set/tests/check().(set_d.unionrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]union().(&set_c), (3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#9).revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().().chainrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#chain().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3)); |
| 519 | } |
| 520 | |
| 521 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 522 | fn opsrust-analyzer cargo ordermap 1.2.0 set/tests/ops().() { |
| 523 | let empty = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::<i32>::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 524 | let set_a: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 525 | let set_b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = (3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 526 | let set_c: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 527 | let set_d: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = (3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#9).revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 528 | |
| 529 | #[allow(clippy::eq_op)] |
| 530 | { |
| 531 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_a &rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitAnd<&OrderSet<T, S2>>`]bitand(). &set_a, set_a); |
| 532 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_a |rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitOr<&OrderSet<T, S2>>`]bitor(). &set_a, set_a); |
| 533 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_a ^rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitXor<&OrderSet<T, S2>>`]bitxor(). &set_a, empty); |
| 534 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_a -rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`Sub<&OrderSet<T, S2>>`]sub(). &set_a, empty); |
| 535 | } |
| 536 | |
| 537 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_a &rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitAnd<&OrderSet<T, S2>>`]bitand(). &set_b, empty); |
| 538 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_b &rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitAnd<&OrderSet<T, S2>>`]bitand(). &set_a, empty); |
| 539 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_a |rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitOr<&OrderSet<T, S2>>`]bitor(). &set_b, set_c); |
| 540 | assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(&set_b |rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitOr<&OrderSet<T, S2>>`]bitor(). &set_a, set_c); |
| 541 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!((&set_b |rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitOr<&OrderSet<T, S2>>`]bitor(). &set_a).set_eqrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]set_eq().(&set_c)); |
| 542 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_a ^rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitXor<&OrderSet<T, S2>>`]bitxor(). &set_b, set_c); |
| 543 | assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(&set_b ^rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitXor<&OrderSet<T, S2>>`]bitxor(). &set_a, set_c); |
| 544 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!((&set_b ^rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitXor<&OrderSet<T, S2>>`]bitxor(). &set_a).set_eqrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]set_eq().(&set_c)); |
| 545 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_a -rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`Sub<&OrderSet<T, S2>>`]sub(). &set_b, set_a); |
| 546 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_b -rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`Sub<&OrderSet<T, S2>>`]sub(). &set_a, set_b); |
| 547 | |
| 548 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_a &rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitAnd<&OrderSet<T, S2>>`]bitand(). &set_c, set_a); |
| 549 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_c &rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitAnd<&OrderSet<T, S2>>`]bitand(). &set_a, set_a); |
| 550 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_a |rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitOr<&OrderSet<T, S2>>`]bitor(). &set_c, set_c); |
| 551 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_c |rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitOr<&OrderSet<T, S2>>`]bitor(). &set_a, set_c); |
| 552 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_a ^rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitXor<&OrderSet<T, S2>>`]bitxor(). &set_c, set_b); |
| 553 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_c ^rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitXor<&OrderSet<T, S2>>`]bitxor(). &set_a, set_b); |
| 554 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_a -rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`Sub<&OrderSet<T, S2>>`]sub(). &set_c, empty); |
| 555 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_c -rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`Sub<&OrderSet<T, S2>>`]sub(). &set_a, set_b); |
| 556 | |
| 557 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_c &rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitAnd<&OrderSet<T, S2>>`]bitand(). &set_d, set_b); |
| 558 | assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(&set_d &rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitAnd<&OrderSet<T, S2>>`]bitand(). &set_c, set_b); |
| 559 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!((&set_d &rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitAnd<&OrderSet<T, S2>>`]bitand(). &set_c).set_eqrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]set_eq().(&set_b)); |
| 560 | assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(&set_c |rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitOr<&OrderSet<T, S2>>`]bitor(). &set_d, &set_a |rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitOr<&OrderSet<T, S2>>`]bitor(). &set_d); |
| 561 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!((&set_c |rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitOr<&OrderSet<T, S2>>`]bitor(). &set_d).set_eqrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]set_eq().(&(&set_a |rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitOr<&OrderSet<T, S2>>`]bitor(). &set_d))); |
| 562 | assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(&set_d |rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitOr<&OrderSet<T, S2>>`]bitor(). &set_c, &set_a |rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitOr<&OrderSet<T, S2>>`]bitor(). &set_d); |
| 563 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!((&set_d |rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitOr<&OrderSet<T, S2>>`]bitor(). &set_c).set_eqrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]set_eq().(&(&set_a |rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitOr<&OrderSet<T, S2>>`]bitor(). &set_d))); |
| 564 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_c ^rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitXor<&OrderSet<T, S2>>`]bitxor(). &set_d, &set_a |rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitOr<&OrderSet<T, S2>>`]bitor(). &(&set_d -rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`Sub<&OrderSet<T, S2>>`]sub(). &set_b)); |
| 565 | assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(&set_d ^rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitXor<&OrderSet<T, S2>>`]bitxor(). &set_c, &set_a |rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitOr<&OrderSet<T, S2>>`]bitor(). &(&set_d -rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`Sub<&OrderSet<T, S2>>`]sub(). &set_b)); |
| 566 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!((&set_d ^rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitXor<&OrderSet<T, S2>>`]bitxor(). &set_c).set_eqrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]set_eq().(&(&set_a |rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`BitOr<&OrderSet<T, S2>>`]bitor(). &(&set_d -rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`Sub<&OrderSet<T, S2>>`]sub(). &set_b)))); |
| 567 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_c -rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`Sub<&OrderSet<T, S2>>`]sub(). &set_d, set_a); |
| 568 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&set_d -rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`Sub<&OrderSet<T, S2>>`]sub(). &set_c, &set_d -rust-analyzer cargo ordermap 1.2.0 set/impl#[`&OrderSet<T, S1>`][`Sub<&OrderSet<T, S2>>`]sub(). &set_b); |
| 569 | } |
| 570 | |
| 571 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 572 | #[cfg(feature = "std")] |
| 573 | fn from_arrayrust-analyzer cargo ordermap 1.2.0 set/tests/from_array().() { |
| 574 | let set1 = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::fromrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`][`From<[T; N]>`]from().([1, 2, 3, 4]); |
| 575 | let set2: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = [1, 2, 3, 4].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 576 | |
| 577 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set1, set2); |
| 578 | } |
| 579 | |
| 580 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 581 | fn iter_defaultrust-analyzer cargo ordermap 1.2.0 set/tests/iter_default().() { |
| 582 | struct Itemrust-analyzer cargo ordermap 1.2.0 set/tests/Item#; |
| 583 | fn assert_defaultrust-analyzer cargo ordermap 1.2.0 set/tests/assert_default().<T>() |
| 584 | where |
| 585 | 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#, |
| 586 | { |
| 587 | 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().()); |
| 588 | } |
| 589 | assert_defaultrust-analyzer cargo ordermap 1.2.0 set/tests/assert_default().::<Iterrust-analyzer cargo indexmap 2.14.0 set/iter/Iter#<'static, Itemrust-analyzer cargo ordermap 1.2.0 set/tests/Item#>>(); |
| 590 | assert_defaultrust-analyzer cargo ordermap 1.2.0 set/tests/assert_default().::<IntoIterrust-analyzer cargo indexmap 2.14.0 set/iter/IntoIter#<Itemrust-analyzer cargo ordermap 1.2.0 set/tests/Item#>>(); |
| 591 | } |
| 592 | |
| 593 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 594 | #[allow(deprecated)] |
| 595 | fn takerust-analyzer cargo ordermap 1.2.0 set/tests/take().() { |
| 596 | let mut index_set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 597 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(10); |
| 598 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(index_set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 1); |
| 599 | |
| 600 | let result = index_set.takerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]take().(&10); |
| 601 | 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#(10)); |
| 602 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(index_set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 0); |
| 603 | |
| 604 | let result = index_set.takerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]take().(&20); |
| 605 | 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#); |
| 606 | } |
| 607 | |
| 608 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 609 | fn swap_takerust-analyzer cargo ordermap 1.2.0 set/tests/swap_take().() { |
| 610 | let mut index_set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 611 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(10); |
| 612 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(20); |
| 613 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(30); |
| 614 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(40); |
| 615 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(index_set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 4); |
| 616 | |
| 617 | let result = index_set.swap_takerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]swap_take().(&20); |
| 618 | 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#(20)); |
| 619 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(index_set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 3); |
| 620 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(index_set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[10, 40, 30]); |
| 621 | |
| 622 | let result = index_set.swap_takerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]swap_take().(&50); |
| 623 | 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#); |
| 624 | } |
| 625 | |
| 626 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 627 | fn sort_unstablerust-analyzer cargo ordermap 1.2.0 set/tests/sort_unstable().() { |
| 628 | let mut index_set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 629 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(30); |
| 630 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(20); |
| 631 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(10); |
| 632 | |
| 633 | index_set.sort_unstablerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]sort_unstable().(); |
| 634 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(index_set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[10, 20, 30]); |
| 635 | } |
| 636 | |
| 637 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 638 | fn try_reserve_exactrust-analyzer cargo ordermap 1.2.0 set/tests/try_reserve_exact().() { |
| 639 | let mut index_set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 640 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(10); |
| 641 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(20); |
| 642 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(30); |
| 643 | index_set.shrink_to_fitrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]shrink_to_fit().(); |
| 644 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(index_set.capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]capacity().(), 3); |
| 645 | |
| 646 | index_set.try_reserve_exactrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]try_reserve_exact().(2).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 647 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(index_set.capacityrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]capacity().(), 5); |
| 648 | } |
| 649 | |
| 650 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 651 | fn shift_remove_fullrust-analyzer cargo ordermap 1.2.0 set/tests/shift_remove_full().() { |
| 652 | let mut set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 653 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(10); |
| 654 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(20); |
| 655 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(30); |
| 656 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(40); |
| 657 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(50); |
| 658 | |
| 659 | let result = set.remove_fullrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]remove_full().(&20); |
| 660 | 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, 20))); |
| 661 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 4); |
| 662 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[10, 30, 40, 50]); |
| 663 | |
| 664 | let result = set.remove_fullrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]remove_full().(&50); |
| 665 | 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, 50))); |
| 666 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 3); |
| 667 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[10, 30, 40]); |
| 668 | |
| 669 | let result = set.remove_fullrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]remove_full().(&60); |
| 670 | 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#); |
| 671 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 3); |
| 672 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[10, 30, 40]); |
| 673 | } |
| 674 | |
| 675 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 676 | fn shift_remove_indexrust-analyzer cargo ordermap 1.2.0 set/tests/shift_remove_index().() { |
| 677 | let mut set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 678 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(10); |
| 679 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(20); |
| 680 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(30); |
| 681 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(40); |
| 682 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(50); |
| 683 | |
| 684 | let result = set.remove_indexrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]remove_index().(1); |
| 685 | 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#(20)); |
| 686 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 4); |
| 687 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[10, 30, 40, 50]); |
| 688 | |
| 689 | let result = set.remove_indexrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]remove_index().(1); |
| 690 | 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#(30)); |
| 691 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 3); |
| 692 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[10, 40, 50]); |
| 693 | |
| 694 | let result = set.remove_indexrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]remove_index().(3); |
| 695 | 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#); |
| 696 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 3); |
| 697 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[10, 40, 50]); |
| 698 | } |
| 699 | |
| 700 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 701 | fn sort_unstable_byrust-analyzer cargo ordermap 1.2.0 set/tests/sort_unstable_by().() { |
| 702 | let mut set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::fromrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`][`From<[T; N]>`]from().([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); |
| 703 | set.sort_unstable_byrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]sort_unstable_by().(|a, b| b.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(a)); |
| 704 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]); |
| 705 | } |
| 706 | |
| 707 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 708 | fn sort_byrust-analyzer cargo ordermap 1.2.0 set/tests/sort_by().() { |
| 709 | let mut set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 710 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(3); |
| 711 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(1); |
| 712 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(2); |
| 713 | set.sort_byrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]sort_by().(|a, b| a.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(b)); |
| 714 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[1, 2, 3]); |
| 715 | } |
| 716 | |
| 717 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 718 | fn drainrust-analyzer cargo ordermap 1.2.0 set/tests/drain().() { |
| 719 | let mut set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 720 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(1); |
| 721 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(2); |
| 722 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(3); |
| 723 | |
| 724 | { |
| 725 | let drain = set.drainrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]drain().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#2); |
| 726 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(drain.as_slicerust-analyzer cargo indexmap 2.14.0 set/iter/impl#[`Drain<'a, T>`]as_slice().(), &[1, 2]); |
| 727 | } |
| 728 | |
| 729 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 1); |
| 730 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[3]); |
| 731 | } |
| 732 | |
| 733 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 734 | fn split_offrust-analyzer cargo ordermap 1.2.0 set/tests/split_off().() { |
| 735 | let mut set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::fromrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`][`From<[T; N]>`]from().([1, 2, 3, 4, 5]); |
| 736 | let split_set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = set.split_offrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]split_off().(3); |
| 737 | |
| 738 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(split_set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 2); |
| 739 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(split_set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[4, 5]); |
| 740 | |
| 741 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 3); |
| 742 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[1, 2, 3]); |
| 743 | } |
| 744 | |
| 745 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 746 | fn retainrust-analyzer cargo ordermap 1.2.0 set/tests/retain().() { |
| 747 | let mut set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::fromrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`][`From<[T; N]>`]from().([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); |
| 748 | set.retainrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]retain().(|&x| x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt().4); |
| 749 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 6); |
| 750 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[5, 6, 7, 8, 9, 10]); |
| 751 | |
| 752 | set.retainrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]retain().(|_| false); |
| 753 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 0); |
| 754 | } |
| 755 | |
| 756 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 757 | fn firstrust-analyzer cargo ordermap 1.2.0 set/tests/first().() { |
| 758 | let mut index_set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 759 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(10); |
| 760 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(20); |
| 761 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(30); |
| 762 | |
| 763 | let result = index_set.firstrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]first().(); |
| 764 | 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().result.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 10); |
| 765 | |
| 766 | index_set.clearrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]clear().(); |
| 767 | let result = index_set.firstrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]first().(); |
| 768 | 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().()); |
| 769 | } |
| 770 | |
| 771 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 772 | fn sort_by_keyrust-analyzer cargo ordermap 1.2.0 set/tests/sort_by_key().() { |
| 773 | let mut index_set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 774 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(3); |
| 775 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(1); |
| 776 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(2); |
| 777 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(0); |
| 778 | index_set.sort_by_keyrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]sort_by_key().(|&x| -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().x); |
| 779 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(index_set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[3, 2, 1, 0]); |
| 780 | } |
| 781 | |
| 782 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 783 | fn sort_unstable_by_keyrust-analyzer cargo ordermap 1.2.0 set/tests/sort_unstable_by_key().() { |
| 784 | let mut index_set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 785 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(3); |
| 786 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(1); |
| 787 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(2); |
| 788 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(0); |
| 789 | index_set.sort_unstable_by_keyrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]sort_unstable_by_key().(|&x| -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().x); |
| 790 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(index_set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[3, 2, 1, 0]); |
| 791 | } |
| 792 | |
| 793 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 794 | fn sort_by_cached_keyrust-analyzer cargo ordermap 1.2.0 set/tests/sort_by_cached_key().() { |
| 795 | let mut index_set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 796 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(3); |
| 797 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(1); |
| 798 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(2); |
| 799 | index_set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(0); |
| 800 | index_set.sort_by_cached_keyrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]sort_by_cached_key().(|&x| -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().x); |
| 801 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(index_set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[3, 2, 1, 0]); |
| 802 | } |
| 803 | |
| 804 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 805 | fn insert_sortedrust-analyzer cargo ordermap 1.2.0 set/tests/insert_sorted().() { |
| 806 | let mut set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::<i32>::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 807 | set.insert_sortedrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert_sorted().(1); |
| 808 | set.insert_sortedrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert_sorted().(3); |
| 809 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.insert_sortedrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert_sorted().(2), (1, true)); |
| 810 | } |
| 811 | |
| 812 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 813 | fn binary_searchrust-analyzer cargo ordermap 1.2.0 set/tests/binary_search().() { |
| 814 | let mut set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 815 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(100); |
| 816 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(300); |
| 817 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(200); |
| 818 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(400); |
| 819 | let result = set.binary_searchrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]binary_search().(&200); |
| 820 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(result, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(2)); |
| 821 | |
| 822 | let result = set.binary_searchrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]binary_search().(&500); |
| 823 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(result, Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(4)); |
| 824 | } |
| 825 | |
| 826 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 827 | fn sorted_unstable_byrust-analyzer cargo ordermap 1.2.0 set/tests/sorted_unstable_by().() { |
| 828 | let mut set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::fromrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`][`From<[T; N]>`]from().([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); |
| 829 | set.sort_unstable_byrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]sort_unstable_by().(|a, b| b.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][Ord]cmp().(a)); |
| 830 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]); |
| 831 | } |
| 832 | |
| 833 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 834 | fn lastrust-analyzer cargo ordermap 1.2.0 set/tests/last().() { |
| 835 | let mut set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 836 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(1); |
| 837 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(2); |
| 838 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(3); |
| 839 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(4); |
| 840 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(5); |
| 841 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(6); |
| 842 | |
| 843 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lastrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]last().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&6)); |
| 844 | |
| 845 | set.poprust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]pop().(); |
| 846 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lastrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]last().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&5)); |
| 847 | |
| 848 | set.clearrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]clear().(); |
| 849 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lastrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]last().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 850 | } |
| 851 | |
| 852 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 853 | fn get_rangerust-analyzer cargo ordermap 1.2.0 set/tests/get_range().() { |
| 854 | let set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::fromrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`][`From<[T; N]>`]from().([1, 2, 3, 4, 5]); |
| 855 | let result = set.get_rangerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get_range().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3); |
| 856 | let slice: &Slicerust-analyzer cargo indexmap 2.14.0 set/slice/Slice#<i32> = result.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 857 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(slice, &[1, 2, 3]); |
| 858 | |
| 859 | let result = set.get_rangerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get_range().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#0); |
| 860 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(result.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().lenrust-analyzer cargo indexmap 2.14.0 set/slice/impl#[`Slice<T>`]len().(), 0); |
| 861 | |
| 862 | let result = set.get_rangerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]get_range().(2..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1); |
| 863 | 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().()); |
| 864 | } |
| 865 | |
| 866 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 867 | fn shift_takerust-analyzer cargo ordermap 1.2.0 set/tests/shift_take().() { |
| 868 | let mut set: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::newrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T>`]new().(); |
| 869 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(1); |
| 870 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(2); |
| 871 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(3); |
| 872 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(4); |
| 873 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(5); |
| 874 | |
| 875 | let result = set.takerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]take().(&2); |
| 876 | 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#(2)); |
| 877 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 4); |
| 878 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[1, 3, 4, 5]); |
| 879 | |
| 880 | let result = set.takerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]take().(&5); |
| 881 | 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)); |
| 882 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 3); |
| 883 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[1, 3, 4]); |
| 884 | |
| 885 | let result = set.takerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]take().(&5); |
| 886 | 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#); |
| 887 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.lenrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]len().(), 3); |
| 888 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(set.as_slicerust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]as_slice().(), &[1, 3, 4]); |
| 889 | } |
| 890 | |
| 891 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 892 | fn test_binary_search_byrust-analyzer cargo ordermap 1.2.0 set/tests/test_binary_search_by().() { |
| 893 | // adapted from std's test for binary_search |
| 894 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = [].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 895 | 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 set/impl#[`OrderSet<T, 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)); |
| 896 | |
| 897 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = [4].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 898 | 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 set/impl#[`OrderSet<T, 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)); |
| 899 | 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 set/impl#[`OrderSet<T, 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)); |
| 900 | 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 set/impl#[`OrderSet<T, 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)); |
| 901 | |
| 902 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = [1, 2, 4, 6, 8, 9].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 903 | 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 set/impl#[`OrderSet<T, 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)); |
| 904 | 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 set/impl#[`OrderSet<T, 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)); |
| 905 | 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 set/impl#[`OrderSet<T, 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)); |
| 906 | 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 set/impl#[`OrderSet<T, 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)); |
| 907 | |
| 908 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = [1, 2, 4, 5, 6, 8].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 909 | 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 set/impl#[`OrderSet<T, 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)); |
| 910 | |
| 911 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = [1, 2, 4, 6, 7, 8, 9].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 912 | 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 set/impl#[`OrderSet<T, 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)); |
| 913 | 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 set/impl#[`OrderSet<T, 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)); |
| 914 | 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 set/impl#[`OrderSet<T, 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)); |
| 915 | |
| 916 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = [1, 2, 4, 5, 6, 8, 9].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 917 | 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 set/impl#[`OrderSet<T, 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)); |
| 918 | 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 set/impl#[`OrderSet<T, 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)); |
| 919 | |
| 920 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = [1, 3, 3, 3, 7].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 921 | 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 set/impl#[`OrderSet<T, 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)); |
| 922 | 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 set/impl#[`OrderSet<T, 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)); |
| 923 | 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 set/impl#[`OrderSet<T, 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)); |
| 924 | // diff from std as set merges the duplicate keys |
| 925 | 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 set/impl#[`OrderSet<T, 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)) { |
| 926 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(1..=2) => true, |
| 927 | _ => false, |
| 928 | }); |
| 929 | 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 set/impl#[`OrderSet<T, 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)) { |
| 930 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(1..=2) => true, |
| 931 | _ => false, |
| 932 | }); |
| 933 | 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 set/impl#[`OrderSet<T, 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#(2)); |
| 934 | 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 set/impl#[`OrderSet<T, 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#(2)); |
| 935 | 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 set/impl#[`OrderSet<T, 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#(2)); |
| 936 | 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 set/impl#[`OrderSet<T, 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#(2)); |
| 937 | 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 set/impl#[`OrderSet<T, 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#(3)); |
| 938 | } |
| 939 | |
| 940 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 941 | fn test_binary_search_by_keyrust-analyzer cargo ordermap 1.2.0 set/tests/test_binary_search_by_key().() { |
| 942 | // adapted from std's test for binary_search |
| 943 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = [].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 944 | 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&5, |&x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(0)); |
| 945 | |
| 946 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = [4].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&3, |&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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&4, |&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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&5, |&x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(1)); |
| 950 | |
| 951 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = [1, 2, 4, 6, 8, 9].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 952 | 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&5, |&x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(3)); |
| 953 | 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&6, |&x| x), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(3)); |
| 954 | 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&7, |&x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(4)); |
| 955 | 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&8, |&x| x), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(4)); |
| 956 | |
| 957 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = [1, 2, 4, 5, 6, 8].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&9, |&x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(6)); |
| 959 | |
| 960 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = [1, 2, 4, 6, 7, 8, 9].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&6, |&x| x), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(3)); |
| 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&5, |&x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(3)); |
| 963 | 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&8, |&x| x), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(5)); |
| 964 | |
| 965 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = [1, 2, 4, 5, 6, 8, 9].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 966 | 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&7, |&x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(5)); |
| 967 | 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&0, |&x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(0)); |
| 968 | |
| 969 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = [1, 3, 3, 3, 7].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 970 | 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&0, |&x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(0)); |
| 971 | 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&1, |&x| x), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(0)); |
| 972 | 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&2, |&x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(1)); |
| 973 | // diff from std as set merges the duplicate keys |
| 974 | 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&3, |&x| x) { |
| 975 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(1..=2) => true, |
| 976 | _ => false, |
| 977 | }); |
| 978 | 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&3, |&x| x) { |
| 979 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(1..=2) => true, |
| 980 | _ => false, |
| 981 | }); |
| 982 | 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&4, |&x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(2)); |
| 983 | 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&5, |&x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(2)); |
| 984 | 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&6, |&x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(2)); |
| 985 | 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&7, |&x| x), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(2)); |
| 986 | 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 set/impl#[`OrderSet<T, S>`]binary_search_by_key().(&8, |&x| x), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(3)); |
| 987 | } |
| 988 | |
| 989 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 990 | fn test_partition_pointrust-analyzer cargo ordermap 1.2.0 set/tests/test_partition_point().() { |
| 991 | // adapted from std's test for partition_point |
| 992 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32> = [].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 993 | 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 set/impl#[`OrderSet<T, 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); |
| 994 | |
| 995 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = [4].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 996 | 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 set/impl#[`OrderSet<T, 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); |
| 997 | 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 set/impl#[`OrderSet<T, 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); |
| 998 | 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 set/impl#[`OrderSet<T, 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); |
| 999 | |
| 1000 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = [1, 2, 4, 6, 8, 9].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 1001 | 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 set/impl#[`OrderSet<T, 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); |
| 1002 | 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 set/impl#[`OrderSet<T, 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); |
| 1003 | 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 set/impl#[`OrderSet<T, 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); |
| 1004 | 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 set/impl#[`OrderSet<T, 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); |
| 1005 | |
| 1006 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = [1, 2, 4, 5, 6, 8].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 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 set/impl#[`OrderSet<T, 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); |
| 1008 | |
| 1009 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = [1, 2, 4, 6, 7, 8, 9].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 1010 | 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 set/impl#[`OrderSet<T, 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); |
| 1011 | 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 set/impl#[`OrderSet<T, 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); |
| 1012 | 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 set/impl#[`OrderSet<T, 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); |
| 1013 | |
| 1014 | let b: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = [1, 2, 4, 5, 6, 8, 9].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 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 set/impl#[`OrderSet<T, 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 set/impl#[`OrderSet<T, 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: OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<_> = [1, 3, 3, 3, 7].intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 1019 | 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 set/impl#[`OrderSet<T, 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); |
| 1020 | 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 set/impl#[`OrderSet<T, 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); |
| 1021 | 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 set/impl#[`OrderSet<T, 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); |
| 1022 | 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 set/impl#[`OrderSet<T, 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); |
| 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 set/impl#[`OrderSet<T, 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), 2); // diff from std as set merges the duplicate keys |
| 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 set/impl#[`OrderSet<T, 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), 2); |
| 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 set/impl#[`OrderSet<T, 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), 2); |
| 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 set/impl#[`OrderSet<T, 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), 2); |
| 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 set/impl#[`OrderSet<T, 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), 3); |
| 1028 | } |
| 1029 | |
| 1030 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1031 | fn is_sortedrust-analyzer cargo ordermap 1.2.0 set/tests/is_sorted().() { |
| 1032 | fn expectrust-analyzer cargo ordermap 1.2.0 set/tests/expect().(set: &OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32>, e: [bool; 4]) { |
| 1033 | 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()., set.is_sortedrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_sorted().()); |
| 1034 | 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()., set.is_sorted_byrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, 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)); |
| 1035 | 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()., set.is_sorted_byrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, 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)); |
| 1036 | 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()., set.is_sorted_by_keyrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_sorted_by_key().(|v| v)); |
| 1037 | } |
| 1038 | |
| 1039 | let mut set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::<i32>::from_iterrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`][`FromIterator<T>`]from_iter().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10); |
| 1040 | expectrust-analyzer cargo ordermap 1.2.0 set/tests/expect().(&set, [true, true, false, true]); |
| 1041 | |
| 1042 | set.replace_indexrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, 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().(); |
| 1043 | expectrust-analyzer cargo ordermap 1.2.0 set/tests/expect().(&set, [false, false, false, false]); |
| 1044 | } |
| 1045 | |
| 1046 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1047 | fn is_sorted_trivialrust-analyzer cargo ordermap 1.2.0 set/tests/is_sorted_trivial().() { |
| 1048 | fn expectrust-analyzer cargo ordermap 1.2.0 set/tests/expect().(set: &OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#<i32>, e: [bool; 5]) { |
| 1049 | 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()., set.is_sortedrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_sorted().()); |
| 1050 | 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()., set.is_sorted_byrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_sorted_by().(|_, _| true)); |
| 1051 | 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()., set.is_sorted_byrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_sorted_by().(|_, _| false)); |
| 1052 | 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()., set.is_sorted_by_keyrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_sorted_by_key().(|_| 0f64)); |
| 1053 | 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()., set.is_sorted_by_keyrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]is_sorted_by_key().(|_| f64::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]NAN.)); |
| 1054 | } |
| 1055 | |
| 1056 | let mut set = OrderSetrust-analyzer cargo ordermap 1.2.0 set/OrderSet#::<i32>::defaultrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`][Default]default().(); |
| 1057 | expectrust-analyzer cargo ordermap 1.2.0 set/tests/expect().(&set, [true, true, true, true, true]); |
| 1058 | |
| 1059 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(0); |
| 1060 | expectrust-analyzer cargo ordermap 1.2.0 set/tests/expect().(&set, [true, true, true, true, true]); |
| 1061 | |
| 1062 | set.insertrust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]insert().(1); |
| 1063 | expectrust-analyzer cargo ordermap 1.2.0 set/tests/expect().(&set, [true, true, false, true, false]); |
| 1064 | |
| 1065 | set.reverserust-analyzer cargo ordermap 1.2.0 set/impl#[`OrderSet<T, S>`]reverse().(); |
| 1066 | expectrust-analyzer cargo ordermap 1.2.0 set/tests/expect().(&set, [false, true, false, true, false]); |
| 1067 | } |