| 1 |
use superrust-analyzer cargo rangemap 1.7.1 crate/::range_wrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/::RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#; |
| 2 |
use craterust-analyzer cargo rangemap 1.7.1 crate/::range_wrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/::RangeInclusiveEndWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#; |
| 3 |
use craterust-analyzer cargo rangemap 1.7.1 crate/::std_extrust-analyzer cargo rangemap 1.7.1 std_ext/::*; |
| 4 |
use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::collectionsrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/::BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#; |
| 5 |
use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/::Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#; |
| 6 |
use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#; |
| 7 |
use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::{selfrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#}; |
| 8 |
use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/::Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#; |
| 9 |
use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::{DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator#, FromIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/FromIterator#}; |
| 10 |
use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#; |
| 11 |
use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::{RangeFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#, RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#}; |
| 12 |
use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::preluderust-analyzer cargo core https://github.com/rust-lang/rust/library/core prelude/::v1rust-analyzer cargo core https://github.com/rust-lang/rust/library/core prelude/v1/::*; |
| 13 |
|
| 14 |
#[cfg(feature = "serde1")] |
| 15 |
use serderust-analyzer cargo serde 1.0.219 crate/::{ |
| 16 |
derust-analyzer cargo serde 1.0.219 de/::{Deserializerust-analyzer cargo serde 1.0.219 de/Deserialize#, Deserializerrust-analyzer cargo serde 1.0.219 de/Deserializer#, SeqAccessrust-analyzer cargo serde 1.0.219 de/SeqAccess#, Visitorrust-analyzer cargo serde 1.0.219 de/Visitor#}, |
| 17 |
serrust-analyzer cargo serde 1.0.219 ser/::{Serializerust-analyzer cargo serde 1.0.219 ser/Serialize#, Serializerrust-analyzer cargo serde 1.0.219 ser/Serializer#}, |
| 18 |
}; |
| 19 |
|
| 20 |
/// A map whose keys are stored as ranges bounded |
| 21 |
/// inclusively below and above `(start..=end)`. |
| 22 |
/// |
| 23 |
/// Contiguous and overlapping ranges that map to the same value |
| 24 |
/// are coalesced into a single range. |
| 25 |
/// |
| 26 |
/// Successor and predecessor functions must be provided for |
| 27 |
/// the key type `K`, so that we can detect adjacent but non-overlapping |
| 28 |
/// (closed) ranges. (This is not a problem for half-open ranges, |
| 29 |
/// because adjacent ranges can be detected using equality of range ends alone.) |
| 30 |
/// |
| 31 |
/// You can provide these functions either by implementing the |
| 32 |
/// [`StepLite`] trait for your key type `K`, or, |
| 33 |
/// if this is impossible because of Rust's "orphan rules", |
| 34 |
/// you can provide equivalent free functions using the `StepFnsT` type parameter. |
| 35 |
/// [`StepLite`] is implemented for all standard integer types, |
| 36 |
/// but not for any third party crate types. |
| 37 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 38 |
pub struct RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V, StepFnsT = K> { |
| 39 |
// Wrap ranges so that they are `Ord`. |
| 40 |
// See `range_wrapper.rs` for explanation. |
| 41 |
pub(craterust-analyzer cargo rangemap 1.7.1 crate/) btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>, V>, |
| 42 |
_phantomrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#_phantom.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<StepFnsT>, |
| 43 |
} |
| 44 |
|
| 45 |
impl<K, V, StepFnsT> Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V, StepFnsT> { |
| 46 |
fn defaultrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`][Default]default().() -> Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`][Default] { |
| 47 |
Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`][Default] { |
| 48 |
btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::defaultrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`][Default]default().(), |
| 49 |
_phantomrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#_phantom.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 50 |
} |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
impl<K, V, StepFnsT> Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash# for RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V, StepFnsT> |
| 55 |
where |
| 56 |
K: Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#, |
| 57 |
V: Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#, |
| 58 |
{ |
| 59 |
fn hashrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`][Hash]hash().<H: corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/::Hasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hasher#>(&self, state: &mut H) { |
| 60 |
state.write_usizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hasher#write_usize().(self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]len().()); |
| 61 |
for elt in self.iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]iter().() { |
| 62 |
elt.hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/impls/impl#[`(T, B)`][Hash]hash().(state); |
| 63 |
} |
| 64 |
} |
| 65 |
} |
| 66 |
|
| 67 |
impl<K, V, StepFnsT> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# for RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V, StepFnsT> |
| 68 |
where |
| 69 |
K: PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#, |
| 70 |
V: PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#, |
| 71 |
{ |
| 72 |
fn eqrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`][`PartialEq<Self>`]eq().(&self, other: &RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V, StepFnsT>) -> bool { |
| 73 |
self.iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]iter().().eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().(other.iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]iter().()) |
| 74 |
} |
| 75 |
} |
| 76 |
|
| 77 |
impl<K, V, StepFnsT> Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq# for RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V, StepFnsT> |
| 78 |
where |
| 79 |
K: Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq#, |
| 80 |
V: Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq#, |
| 81 |
{ |
| 82 |
} |
| 83 |
|
| 84 |
impl<K, V, StepFnsT> PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd# for RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V, StepFnsT> |
| 85 |
where |
| 86 |
K: PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#, |
| 87 |
V: PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#, |
| 88 |
{ |
| 89 |
#[inline] |
| 90 |
fn partial_cmprust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`][`PartialOrd<Self>`]partial_cmp().(&self, other: &RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V, StepFnsT>) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#> { |
| 91 |
self.expanded_iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]expanded_iter().().partial_cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#partial_cmp().(other.expanded_iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]expanded_iter().()) |
| 92 |
} |
| 93 |
} |
| 94 |
|
| 95 |
impl<K, V, StepFnsT> Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# for RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V, StepFnsT> |
| 96 |
where |
| 97 |
K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 98 |
V: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 99 |
{ |
| 100 |
#[inline] |
| 101 |
fn cmprust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`][Ord]cmp().(&self, other: &RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V, StepFnsT>) -> Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering# { |
| 102 |
self.expanded_iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]expanded_iter().().cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cmp().(other.expanded_iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]expanded_iter().()) |
| 103 |
} |
| 104 |
} |
| 105 |
|
| 106 |
#[cfg(feature = "quickcheck")] |
| 107 |
impl<K, V> quickcheckrust-analyzer cargo quickcheck 1.0.3 crate/::Arbitraryrust-analyzer cargo quickcheck 1.0.3 arbitrary/Arbitrary# for RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V> |
| 108 |
where |
| 109 |
K: quickcheckrust-analyzer cargo quickcheck 1.0.3 crate/::Arbitraryrust-analyzer cargo quickcheck 1.0.3 arbitrary/Arbitrary# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + StepLiterust-analyzer cargo rangemap 1.7.1 std_ext/StepLite#, |
| 110 |
V: quickcheckrust-analyzer cargo quickcheck 1.0.3 crate/::Arbitraryrust-analyzer cargo quickcheck 1.0.3 arbitrary/Arbitrary# + PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#, |
| 111 |
{ |
| 112 |
fn arbitraryrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`][Arbitrary]arbitrary().(g: &mut quickcheckrust-analyzer cargo quickcheck 1.0.3 crate/::Genrust-analyzer cargo quickcheck 1.0.3 arbitrary/Gen#) -> Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`][Arbitrary] { |
| 113 |
// REVISIT: allocation could be avoided if Gen::gen_size were public (https://github.com/BurntSushi/quickcheck/issues/326#issue-2653601170) |
| 114 |
<allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<_>, _)>>::arbitraryrust-analyzer cargo quickcheck 1.0.3 arbitrary/impl#[`Vec<A>`][Arbitrary]arbitrary().(g) |
| 115 |
.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().() |
| 116 |
.filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|(range, _)| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().range.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]is_empty().()) |
| 117 |
.collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 118 |
} |
| 119 |
} |
| 120 |
|
| 121 |
impl<K, V, StepFnsT> RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V, StepFnsT> { |
| 122 |
/// Gets an iterator over all pairs of key range and value, |
| 123 |
/// ordered by key range. |
| 124 |
/// |
| 125 |
/// The iterator element type is `(&'a RangeInclusive<K>, &'a V)`. |
| 126 |
pub fn iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]iter().(&self) -> Iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/Iter#<'_, K, V> { |
| 127 |
Iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/Iter# { |
| 128 |
innerrust-analyzer cargo rangemap 1.7.1 inclusive_map/Iter#inner.: self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]iter().(), |
| 129 |
} |
| 130 |
} |
| 131 |
|
| 132 |
// Iterate pairs of (range start, range end, value) for comparisons. |
| 133 |
fn expanded_iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]expanded_iter().(&self) -> impl 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# = (&K, &K, &V)> { |
| 134 |
self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(k, v)| (k.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().(), k.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().(), v)) |
| 135 |
} |
| 136 |
} |
| 137 |
|
| 138 |
impl<K, V> RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V, K> |
| 139 |
where |
| 140 |
K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + StepLiterust-analyzer cargo rangemap 1.7.1 std_ext/StepLite#, |
| 141 |
V: PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 142 |
{ |
| 143 |
/// Makes a new empty `RangeInclusiveMap`. |
| 144 |
#[cfg(feature = "const_fn")] |
| 145 |
pub const fn newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().() -> Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`] { |
| 146 |
Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]::new_with_step_fnsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]new_with_step_fns().() |
| 147 |
} |
| 148 |
|
| 149 |
/// Makes a new empty `RangeInclusiveMap`. |
| 150 |
#[cfg(not(feature = "const_fn"))] |
| 151 |
pub fn new() -> Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`] { |
| 152 |
Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]::new_with_step_fns() |
| 153 |
} |
| 154 |
} |
| 155 |
|
| 156 |
impl<K, V, StepFnsT> RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V, StepFnsT> |
| 157 |
where |
| 158 |
K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 159 |
V: PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 160 |
StepFnsT: StepFnsrust-analyzer cargo rangemap 1.7.1 std_ext/StepFns#<K>, |
| 161 |
{ |
| 162 |
/// Makes a new empty `RangeInclusiveMap`, specifying successor and |
| 163 |
/// predecessor functions defined separately from `K` itself. |
| 164 |
/// |
| 165 |
/// This is useful as a workaround for Rust's "orphan rules", |
| 166 |
/// which prevent you from implementing `StepLite` for `K` if `K` |
| 167 |
/// is a foreign type. |
| 168 |
/// |
| 169 |
/// **NOTE:** This will likely be deprecated and then eventually |
| 170 |
/// removed once the standard library's [Step](core::iter::Step) |
| 171 |
/// trait is stabilised, as most crates will then likely implement [Step](core::iter::Step) |
| 172 |
/// for their types where appropriate. |
| 173 |
/// |
| 174 |
/// See [this issue](https://github.com/rust-lang/rust/issues/42168) |
| 175 |
/// for details about that stabilization process. |
| 176 |
#[cfg(not(feature = "const_fn"))] |
| 177 |
pub fn new_with_step_fns() -> Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`] { |
| 178 |
Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`] { |
| 179 |
btm: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::new(), |
| 180 |
_phantom: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 181 |
} |
| 182 |
} |
| 183 |
|
| 184 |
#[cfg(feature = "const_fn")] |
| 185 |
pub const fn new_with_step_fnsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]new_with_step_fns().() -> Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`] { |
| 186 |
Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`] { |
| 187 |
btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().(), |
| 188 |
_phantomrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#_phantom.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 189 |
} |
| 190 |
} |
| 191 |
/// Returns a reference to the value corresponding to the given key, |
| 192 |
/// if the key is covered by any range in the map. |
| 193 |
pub fn getrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]get().(&self, key: &K) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&V> { |
| 194 |
self.get_key_valuerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]get_key_value().(key).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(_range, value)| value) |
| 195 |
} |
| 196 |
|
| 197 |
/// Returns the range-value pair (as a pair of references) corresponding |
| 198 |
/// to the given key, if the key is covered by any range in the map. |
| 199 |
pub fn get_key_valuerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]get_key_value().(&self, key: &K) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(&RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, &V)> { |
| 200 |
use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#; |
| 201 |
|
| 202 |
// The only stored range that could contain the given key is the |
| 203 |
// last stored range whose start is less than or equal to this key. |
| 204 |
let key_as_start = RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#::newrust-analyzer cargo rangemap 1.7.1 range_wrapper/impl#[`RangeInclusiveStartWrapper<T>`]new().(key.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#key.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()); |
| 205 |
self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm. |
| 206 |
.rangerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]range().((Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Unboundedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Unbounded#, Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Includedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Included#(key_as_start))) |
| 207 |
.next_backrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Range<'a, K, V>`][DoubleEndedIterator]next_back().() |
| 208 |
.filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]filter().(|(range_start_wrapper, _value)| { |
| 209 |
// Does the only candidate range contain |
| 210 |
// the requested key? |
| 211 |
range_start_wrapper.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]contains().(key) |
| 212 |
}) |
| 213 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(range_start_wrapper, value)| (&range_start_wrapper.rangerust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#range., value)) |
| 214 |
} |
| 215 |
|
| 216 |
/// Returns `true` if any range in the map covers the specified key. |
| 217 |
pub fn contains_keyrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]contains_key().(&self, key: &K) -> bool { |
| 218 |
self.getrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]get().(key).is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() |
| 219 |
} |
| 220 |
|
| 221 |
/// Clears the map, removing all elements. |
| 222 |
pub fn clearrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]clear().(&mut self) { |
| 223 |
self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm..clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]clear().(); |
| 224 |
} |
| 225 |
|
| 226 |
/// Returns the number of elements in the map. |
| 227 |
pub fn lenrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]len().(&self) -> usize { |
| 228 |
self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]len().() |
| 229 |
} |
| 230 |
|
| 231 |
/// Returns true if the map contains no elements. |
| 232 |
pub fn is_emptyrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]is_empty().(&self) -> bool { |
| 233 |
self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]is_empty().() |
| 234 |
} |
| 235 |
|
| 236 |
/// Insert a pair of key range and value into the map. |
| 237 |
/// |
| 238 |
/// If the inserted range partially or completely overlaps any |
| 239 |
/// existing range in the map, then the existing range (or ranges) will be |
| 240 |
/// partially or completely replaced by the inserted range. |
| 241 |
/// |
| 242 |
/// If the inserted range either overlaps or is immediately adjacent |
| 243 |
/// any existing range _mapping to the same value_, then the ranges |
| 244 |
/// will be coalesced into a single contiguous range. |
| 245 |
/// |
| 246 |
/// # Panics |
| 247 |
/// |
| 248 |
/// Panics if range `start > end`. |
| 249 |
pub fn insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(&mut self, range: RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, value: V) { |
| 250 |
use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#; |
| 251 |
|
| 252 |
// Backwards ranges don't make sense. |
| 253 |
// `RangeInclusive` doesn't enforce this, |
| 254 |
// and we don't want weird explosions further down |
| 255 |
// if someone gives us such a range. |
| 256 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!( |
| 257 |
range.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().() <= range.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().(), |
| 258 |
"Range start can not be after range end" |
| 259 |
); |
| 260 |
|
| 261 |
// Wrap up the given range so that we can "borrow" |
| 262 |
// it as a wrapper reference to either its start or end. |
| 263 |
// See `range_wrapper.rs` for explanation of these hacks. |
| 264 |
let mut new_range_start_wrapper: RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K> = |
| 265 |
RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#::newrust-analyzer cargo rangemap 1.7.1 range_wrapper/impl#[`RangeInclusiveStartWrapper<T>`]new().(range); |
| 266 |
let new_value = value; |
| 267 |
|
| 268 |
// Is there a stored range either overlapping the start of |
| 269 |
// the range to insert or immediately preceding it? |
| 270 |
// |
| 271 |
// If there is any such stored range, it will be the last |
| 272 |
// whose start is less than or equal to _one less than_ |
| 273 |
// the start of the range to insert, or the one before that |
| 274 |
// if both of the above cases exist. |
| 275 |
let mut candidates = self |
| 276 |
.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm. |
| 277 |
.rangerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]range().::<RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>, ( |
| 278 |
Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#<&RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>>, |
| 279 |
Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#<&RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>>, |
| 280 |
)>((Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Unboundedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Unbounded#, Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Includedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Included#(&new_range_start_wrapper))) |
| 281 |
.revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().() |
| 282 |
.takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().(2) |
| 283 |
.filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|(stored_range_start_wrapper, _stored_value)| { |
| 284 |
// Does the candidate range either overlap |
| 285 |
// or immediately precede the range to insert? |
| 286 |
// (Remember that it might actually cover the _whole_ |
| 287 |
// range to insert and then some.) |
| 288 |
stored_range_start_wrapper |
| 289 |
.touchesrust-analyzer cargo rangemap 1.7.1 std_ext/impl#[`RangeInclusive<T>`][`RangeInclusiveExt<T>`]touches().::<StepFnsT>(&new_range_start_wrapper.end_wrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#end_wrapper..rangerust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#range.) |
| 290 |
}); |
| 291 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(mut candidate) = candidates.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/filter/impl#[`Filter<I, P>`][Iterator]next().() { |
| 292 |
// Or the one before it if both cases described above exist. |
| 293 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(another_candidate) = candidates.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/filter/impl#[`Filter<I, P>`][Iterator]next().() { |
| 294 |
candidate = another_candidate; |
| 295 |
} |
| 296 |
let (stored_range_start_wrapper, stored_value) = |
| 297 |
(candidate.0.clonerust-analyzer cargo rangemap 1.7.1 range_wrapper/impl#[`RangeInclusiveStartWrapper<T>`][Clone]clone().(), candidate.1.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()); |
| 298 |
self.adjust_touching_ranges_for_insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]adjust_touching_ranges_for_insert().( |
| 299 |
stored_range_start_wrapper, |
| 300 |
stored_value, |
| 301 |
&mut new_range_start_wrapper.end_wrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#end_wrapper..rangerust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#range., |
| 302 |
&new_value, |
| 303 |
); |
| 304 |
} |
| 305 |
|
| 306 |
// Are there any stored ranges whose heads overlap or immediately |
| 307 |
// follow the range to insert? |
| 308 |
// |
| 309 |
// If there are any such stored ranges (that weren't already caught above), |
| 310 |
// their starts will fall somewhere after the start of the range to insert, |
| 311 |
// and on, before, or _immediately after_ its end. To handle that last case |
| 312 |
// without risking arithmetic overflow, we'll consider _one more_ stored item past |
| 313 |
// the end of the end of the range to insert. |
| 314 |
// |
| 315 |
// REVISIT: Possible micro-optimisation: `impl Borrow<T> for RangeInclusiveStartWrapper<T>` |
| 316 |
// and use that to search here, to avoid constructing another `RangeInclusiveStartWrapper`. |
| 317 |
let second_last_possible_start = new_range_start_wrapper.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().().clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(); |
| 318 |
let second_last_possible_start = RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#::newrust-analyzer cargo rangemap 1.7.1 range_wrapper/impl#[`RangeInclusiveStartWrapper<T>`]new().( |
| 319 |
second_last_possible_start.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#second_last_possible_start, |
| 320 |
); |
| 321 |
while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((stored_range_start_wrapper, stored_value)) = self |
| 322 |
.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm. |
| 323 |
.rangerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]range().::<RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>, ( |
| 324 |
Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#<&RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>>, |
| 325 |
Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#<&RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>>, |
| 326 |
)>(( |
| 327 |
Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Includedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Included#(&new_range_start_wrapper), |
| 328 |
// We would use something like `Bound::Included(&last_possible_start)`, |
| 329 |
// but making `last_possible_start` might cause arithmetic overflow; |
| 330 |
// instead decide inside the loop whether we've gone too far and break. |
| 331 |
Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Unboundedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Unbounded#, |
| 332 |
)) |
| 333 |
.nextrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Range<'a, K, V>`][Iterator]next().() |
| 334 |
{ |
| 335 |
// A couple of extra exceptions are needed at the |
| 336 |
// end of the subset of stored ranges we want to consider, |
| 337 |
// in part because we use `Bound::Unbounded` above. |
| 338 |
// (See comments up there, and in the individual cases below.) |
| 339 |
let stored_start = stored_range_start_wrapper.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().(); |
| 340 |
if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().stored_start rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().second_last_possible_start.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().() { |
| 341 |
let latest_possible_start = StepFnsT::add_onerust-analyzer cargo rangemap 1.7.1 std_ext/StepFns#add_one().(second_last_possible_start.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().()); |
| 342 |
if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().stored_start rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt().latest_possible_start { |
| 343 |
// We're beyond the last stored range that could be relevant. |
| 344 |
// Avoid wasting time on irrelevant ranges, or even worse, looping forever. |
| 345 |
// (`adjust_touching_ranges_for_insert` below assumes that the given range |
| 346 |
// is relevant, and behaves very poorly if it is handed a range that it |
| 347 |
// shouldn't be touching.) |
| 348 |
break; |
| 349 |
} |
| 350 |
|
| 351 |
if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().stored_start rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().latest_possible_start && *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().stored_value rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().new_value { |
| 352 |
// We are looking at the last stored range that could be relevant, |
| 353 |
// but it has a different value, so we don't want to merge with it. |
| 354 |
// We must explicitly break here as well, because `adjust_touching_ranges_for_insert` |
| 355 |
// below assumes that the given range is relevant, and behaves very poorly if it |
| 356 |
// is handed a range that it shouldn't be touching. |
| 357 |
break; |
| 358 |
} |
| 359 |
} |
| 360 |
|
| 361 |
let stored_range_start_wrapper = stored_range_start_wrapper.clonerust-analyzer cargo rangemap 1.7.1 range_wrapper/impl#[`RangeInclusiveStartWrapper<T>`][Clone]clone().(); |
| 362 |
let stored_value = stored_value.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(); |
| 363 |
|
| 364 |
self.adjust_touching_ranges_for_insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]adjust_touching_ranges_for_insert().( |
| 365 |
stored_range_start_wrapper, |
| 366 |
stored_value, |
| 367 |
&mut new_range_start_wrapper.end_wrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#end_wrapper..rangerust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#range., |
| 368 |
&new_value, |
| 369 |
); |
| 370 |
} |
| 371 |
|
| 372 |
// Insert the (possibly expanded) new range, and we're done! |
| 373 |
self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm..insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(new_range_start_wrapper, new_value); |
| 374 |
} |
| 375 |
|
| 376 |
/// Removes a range from the map, if all or any of it was present. |
| 377 |
/// |
| 378 |
/// If the range to be removed _partially_ overlaps any ranges |
| 379 |
/// in the map, then those ranges will be contracted to no |
| 380 |
/// longer cover the removed range. |
| 381 |
/// |
| 382 |
/// |
| 383 |
/// # Panics |
| 384 |
/// |
| 385 |
/// Panics if range `start > end`. |
| 386 |
pub fn removerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]remove().(&mut self, range: RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>) { |
| 387 |
use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#; |
| 388 |
|
| 389 |
// Backwards ranges don't make sense. |
| 390 |
// `RangeInclusive` doesn't enforce this, |
| 391 |
// and we don't want weird explosions further down |
| 392 |
// if someone gives us such a range. |
| 393 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!( |
| 394 |
range.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().() <= range.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().(), |
| 395 |
"Range start can not be after range end" |
| 396 |
); |
| 397 |
|
| 398 |
let range_start_wrapper: RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K> = |
| 399 |
RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#::newrust-analyzer cargo rangemap 1.7.1 range_wrapper/impl#[`RangeInclusiveStartWrapper<T>`]new().(range); |
| 400 |
let range = &range_start_wrapper.rangerust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#range.; |
| 401 |
|
| 402 |
// Is there a stored range overlapping the start of |
| 403 |
// the range to insert? |
| 404 |
// |
| 405 |
// If there is any such stored range, it will be the last |
| 406 |
// whose start is less than or equal to the start of the range to insert. |
| 407 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((stored_range_start_wrapper, stored_value)) = self |
| 408 |
.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm. |
| 409 |
.rangerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]range().::<RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>, ( |
| 410 |
Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#<&RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>>, |
| 411 |
Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#<&RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>>, |
| 412 |
)>((Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Unboundedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Unbounded#, Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Includedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Included#(&range_start_wrapper))) |
| 413 |
.next_backrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Range<'a, K, V>`][DoubleEndedIterator]next_back().() |
| 414 |
.filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]filter().(|(stored_range_start_wrapper, _stored_value)| { |
| 415 |
// Does the only candidate range overlap |
| 416 |
// the range to insert? |
| 417 |
stored_range_start_wrapper.overlapsrust-analyzer cargo rangemap 1.7.1 std_ext/impl#[`RangeInclusive<T>`][`RangeInclusiveExt<T>`]overlaps().(range) |
| 418 |
}) |
| 419 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(stored_range_start_wrapper, stored_value)| { |
| 420 |
(stored_range_start_wrapper.clonerust-analyzer cargo rangemap 1.7.1 range_wrapper/impl#[`RangeInclusiveStartWrapper<T>`][Clone]clone().(), stored_value.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()) |
| 421 |
}) |
| 422 |
{ |
| 423 |
self.adjust_overlapping_ranges_for_removerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]adjust_overlapping_ranges_for_remove().( |
| 424 |
stored_range_start_wrapper, |
| 425 |
stored_value, |
| 426 |
range, |
| 427 |
); |
| 428 |
} |
| 429 |
|
| 430 |
// Are there any stored ranges whose heads overlap the range to insert? |
| 431 |
// |
| 432 |
// If there are any such stored ranges (that weren't already caught above), |
| 433 |
// their starts will fall somewhere after the start of the range to insert, |
| 434 |
// and on or before its end. |
| 435 |
// |
| 436 |
// REVISIT: Possible micro-optimisation: `impl Borrow<T> for RangeInclusiveStartWrapper<T>` |
| 437 |
// and use that to search here, to avoid constructing another `RangeInclusiveStartWrapper`. |
| 438 |
let new_range_end_as_start = |
| 439 |
RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#::newrust-analyzer cargo rangemap 1.7.1 range_wrapper/impl#[`RangeInclusiveStartWrapper<T>`]new().(range.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().().clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#range.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().().clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()); |
| 440 |
while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((stored_range_start_wrapper, stored_value)) = self |
| 441 |
.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm. |
| 442 |
.rangerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]range().::<RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>, ( |
| 443 |
Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#<&RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>>, |
| 444 |
Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#<&RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>>, |
| 445 |
)>(( |
| 446 |
Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Excludedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Excluded#(&range_start_wrapper), |
| 447 |
Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Includedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Included#(&new_range_end_as_start), |
| 448 |
)) |
| 449 |
.nextrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Range<'a, K, V>`][Iterator]next().() |
| 450 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(stored_range_start_wrapper, stored_value)| { |
| 451 |
(stored_range_start_wrapper.clonerust-analyzer cargo rangemap 1.7.1 range_wrapper/impl#[`RangeInclusiveStartWrapper<T>`][Clone]clone().(), stored_value.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()) |
| 452 |
}) |
| 453 |
{ |
| 454 |
self.adjust_overlapping_ranges_for_removerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]adjust_overlapping_ranges_for_remove().( |
| 455 |
stored_range_start_wrapper, |
| 456 |
stored_value, |
| 457 |
range, |
| 458 |
); |
| 459 |
} |
| 460 |
} |
| 461 |
|
| 462 |
fn adjust_touching_ranges_for_insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]adjust_touching_ranges_for_insert().( |
| 463 |
&mut self, |
| 464 |
stored_range_start_wrapper: RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>, |
| 465 |
stored_value: V, |
| 466 |
new_range: &mut RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, |
| 467 |
new_value: &V, |
| 468 |
) { |
| 469 |
use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::{maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/max()., minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/min().}; |
| 470 |
|
| 471 |
if stored_value rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().new_value { |
| 472 |
// The ranges have the same value, so we can "adopt" |
| 473 |
// the stored range. |
| 474 |
// |
| 475 |
// This means that no matter how big or where the stored range is, |
| 476 |
// we will expand the new range's bounds to subsume it, |
| 477 |
// and then delete the stored range. |
| 478 |
let new_start = minrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/min().(new_range.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().(), stored_range_start_wrapper.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().()).clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(); |
| 479 |
let new_end = maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/max().(new_range.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().(), stored_range_start_wrapper.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().()).clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(); |
| 480 |
*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().new_range = new_start..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#new_end; |
| 481 |
self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm..removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]remove().(&stored_range_start_wrapper); |
| 482 |
} else { |
| 483 |
// The ranges have different values. |
| 484 |
if new_range.overlapsrust-analyzer cargo rangemap 1.7.1 std_ext/impl#[`RangeInclusive<T>`][`RangeInclusiveExt<T>`]overlaps().(&stored_range_start_wrapper.rangerust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#range.) { |
| 485 |
// The ranges overlap. This is a little bit more complicated. |
| 486 |
// Delete the stored range, and then add back between |
| 487 |
// 0 and 2 subranges at the ends of the range to insert. |
| 488 |
self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm..removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]remove().(&stored_range_start_wrapper); |
| 489 |
if stored_range_start_wrapper.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]lt().new_range.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().() { |
| 490 |
// Insert the piece left of the range to insert. |
| 491 |
self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm..insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().( |
| 492 |
RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#::newrust-analyzer cargo rangemap 1.7.1 range_wrapper/impl#[`RangeInclusiveStartWrapper<T>`]new().( |
| 493 |
stored_range_start_wrapper.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().().clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() |
| 494 |
..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#StepFnsT::sub_onerust-analyzer cargo rangemap 1.7.1 std_ext/StepFns#sub_one().(new_range.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().()), |
| 495 |
), |
| 496 |
stored_value.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 497 |
); |
| 498 |
} |
| 499 |
if stored_range_start_wrapper.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]gt().new_range.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().() { |
| 500 |
// Insert the piece right of the range to insert. |
| 501 |
self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm..insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().( |
| 502 |
RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#::newrust-analyzer cargo rangemap 1.7.1 range_wrapper/impl#[`RangeInclusiveStartWrapper<T>`]new().( |
| 503 |
StepFnsT::add_onerust-analyzer cargo rangemap 1.7.1 std_ext/StepFns#add_one().(new_range.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().()) |
| 504 |
..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#stored_range_start_wrapper.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().().clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 505 |
), |
| 506 |
stored_value, |
| 507 |
); |
| 508 |
} |
| 509 |
} else { |
| 510 |
// No-op; they're not overlapping, |
| 511 |
// so we can just keep both ranges as they are. |
| 512 |
} |
| 513 |
} |
| 514 |
} |
| 515 |
|
| 516 |
fn adjust_overlapping_ranges_for_removerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]adjust_overlapping_ranges_for_remove().( |
| 517 |
&mut self, |
| 518 |
stored_range_start_wrapper: RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>, |
| 519 |
stored_value: V, |
| 520 |
range_to_remove: &RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, |
| 521 |
) { |
| 522 |
// Delete the stored range, and then add back between |
| 523 |
// 0 and 2 subranges at the ends of the range to insert. |
| 524 |
self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm..removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]remove().(&stored_range_start_wrapper); |
| 525 |
let stored_range = stored_range_start_wrapper.end_wrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#end_wrapper..rangerust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#range.; |
| 526 |
if stored_range.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]lt().range_to_remove.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().() { |
| 527 |
// Insert the piece left of the range to insert. |
| 528 |
self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm..insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().( |
| 529 |
RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#::newrust-analyzer cargo rangemap 1.7.1 range_wrapper/impl#[`RangeInclusiveStartWrapper<T>`]new().( |
| 530 |
stored_range.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().().clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#StepFnsT::sub_onerust-analyzer cargo rangemap 1.7.1 std_ext/StepFns#sub_one().(range_to_remove.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().()), |
| 531 |
), |
| 532 |
stored_value.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 533 |
); |
| 534 |
} |
| 535 |
if stored_range.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]gt().range_to_remove.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().() { |
| 536 |
// Insert the piece right of the range to insert. |
| 537 |
self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm..insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().( |
| 538 |
RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#::newrust-analyzer cargo rangemap 1.7.1 range_wrapper/impl#[`RangeInclusiveStartWrapper<T>`]new().( |
| 539 |
StepFnsT::add_onerust-analyzer cargo rangemap 1.7.1 std_ext/StepFns#add_one().(range_to_remove.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().())..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#stored_range.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().().clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 540 |
), |
| 541 |
stored_value, |
| 542 |
); |
| 543 |
} |
| 544 |
} |
| 545 |
|
| 546 |
/// Gets an iterator over all the maximally-sized ranges |
| 547 |
/// contained in `outer_range` that are not covered by |
| 548 |
/// any range stored in the map. |
| 549 |
/// |
| 550 |
/// The iterator element type is `RangeInclusive<K>`. |
| 551 |
pub fn gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().<'a>(&'a self, outer_range: &'a RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>) -> Gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#<'a, K, V, StepFnsT> { |
| 552 |
let overlap_iter = self.overlappingrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]overlapping().(outer_range); |
| 553 |
Gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps# { |
| 554 |
candidate_needs_plus_onerust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#candidate_needs_plus_one.: false, |
| 555 |
candidate_startrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#candidate_start.: outer_range.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().(), |
| 556 |
query_endrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#query_end.: outer_range.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().(), |
| 557 |
btm_range_iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#btm_range_iter.: overlap_iter.btm_range_iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/Overlapping#btm_range_iter., |
| 558 |
// We'll start the candidate range at the start of the outer range |
| 559 |
// without checking what's there. Each time we yield an item, |
| 560 |
// we'll skip any ranges we find before the next gap. |
| 561 |
_phantomrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#_phantom.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 562 |
} |
| 563 |
} |
| 564 |
|
| 565 |
/// Gets an iterator over all the stored ranges that are |
| 566 |
/// either partially or completely overlapped by the given range. |
| 567 |
pub fn overlappingrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]overlapping().<R: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>>>( |
| 568 |
&'_ self, |
| 569 |
range: R, |
| 570 |
) -> Overlappingrust-analyzer cargo rangemap 1.7.1 inclusive_map/Overlapping#<'_, K, V, R> { |
| 571 |
// Find the first matching stored range by its _end_, |
| 572 |
// using sneaky layering and `Borrow` implementation. (See `range_wrappers` module.) |
| 573 |
let start_sliver = RangeInclusiveEndWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#::newrust-analyzer cargo rangemap 1.7.1 range_wrapper/impl#[`RangeInclusiveEndWrapper<T>`]new().( |
| 574 |
range.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().().startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().().clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#range.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().().startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().().clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 575 |
); |
| 576 |
let btm_range_iter = self |
| 577 |
.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm. |
| 578 |
.rangerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]range().::<RangeInclusiveEndWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#<K>, RangeFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#<&RangeInclusiveEndWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#<K>>>( |
| 579 |
&start_sliver..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#, |
| 580 |
); |
| 581 |
Overlappingrust-analyzer cargo rangemap 1.7.1 inclusive_map/Overlapping# { |
| 582 |
query_rangerust-analyzer cargo rangemap 1.7.1 inclusive_map/Overlapping#query_range.: range, |
| 583 |
btm_range_iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/Overlapping#btm_range_iter., |
| 584 |
} |
| 585 |
} |
| 586 |
|
| 587 |
/// Returns `true` if any range in the map completely or partially |
| 588 |
/// overlaps the given range. |
| 589 |
pub fn overlapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]overlaps().(&self, range: &RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>) -> bool { |
| 590 |
self.overlappingrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]overlapping().(range).nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Overlapping<'a, K, V, R>`][Iterator]next().().is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() |
| 591 |
} |
| 592 |
|
| 593 |
/// Returns the first range-value pair in this map, if one exists. The range in this pair is the |
| 594 |
/// minimum range in the map. |
| 595 |
pub fn first_range_valuerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]first_range_value().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(&RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, &V)> { |
| 596 |
self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm. |
| 597 |
.first_key_valuerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]first_key_value().() |
| 598 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(range, value)| (&range.end_wrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#end_wrapper..rangerust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#range., value)) |
| 599 |
} |
| 600 |
|
| 601 |
/// Returns the last range-value pair in this map, if one exists. The range in this pair is the |
| 602 |
/// maximum range in the map. |
| 603 |
pub fn last_range_valuerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]last_range_value().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(&RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, &V)> { |
| 604 |
self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm. |
| 605 |
.last_key_valuerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]last_key_value().() |
| 606 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(range, value)| (&range.end_wrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#end_wrapper..rangerust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#range., value)) |
| 607 |
} |
| 608 |
} |
| 609 |
|
| 610 |
/// An iterator over the entries of a `RangeInclusiveMap`, ordered by key range. |
| 611 |
/// |
| 612 |
/// The iterator element type is `(&'a RangeInclusive<K>, &'a V)`. |
| 613 |
/// |
| 614 |
/// This `struct` is created by the [`iter`] method on [`RangeInclusiveMap`]. See its |
| 615 |
/// documentation for more. |
| 616 |
/// |
| 617 |
/// [`iter`]: RangeInclusiveMap::iter |
| 618 |
pub struct Iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/Iter#<'a, K, V> { |
| 619 |
innerrust-analyzer cargo rangemap 1.7.1 inclusive_map/Iter#inner.: allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::collectionsrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/::btree_maprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree_map/::Iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/Iter#<'a, RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>, V>, |
| 620 |
} |
| 621 |
|
| 622 |
impl<'a, K, V> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for Iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/Iter#<'a, K, V> |
| 623 |
where |
| 624 |
K: 'a, |
| 625 |
V: 'a, |
| 626 |
{ |
| 627 |
type Itemrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Iter<'a, K, V>`][Iterator]Item# = (&'a RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, &'a V); |
| 628 |
|
| 629 |
fn nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Iter<'a, K, V>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Iter<'a, K, V>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 630 |
self.innerrust-analyzer cargo rangemap 1.7.1 inclusive_map/Iter#inner..nextrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Iter<'a, K, V>`][Iterator]next().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(by_start, v)| (&by_start.rangerust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#range., v)) |
| 631 |
} |
| 632 |
|
| 633 |
fn size_hintrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Iter<'a, K, V>`][Iterator]size_hint().(&self) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) { |
| 634 |
self.innerrust-analyzer cargo rangemap 1.7.1 inclusive_map/Iter#inner..size_hintrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Iter<'a, K, V>`][Iterator]size_hint().() |
| 635 |
} |
| 636 |
} |
| 637 |
|
| 638 |
impl<'a, K, V> DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator# for Iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/Iter#<'a, K, V> |
| 639 |
where |
| 640 |
K: 'a, |
| 641 |
V: 'a, |
| 642 |
{ |
| 643 |
fn next_backrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Iter<'a, K, V>`][DoubleEndedIterator]next_back().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Iter<'a, K, V>`][DoubleEndedIterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 644 |
self.innerrust-analyzer cargo rangemap 1.7.1 inclusive_map/Iter#inner. |
| 645 |
.next_backrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Iter<'a, K, V>`][DoubleEndedIterator]next_back().() |
| 646 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(range, value)| (&range.end_wrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#end_wrapper..rangerust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#range., value)) |
| 647 |
} |
| 648 |
} |
| 649 |
|
| 650 |
/// An owning iterator over the entries of a `RangeInclusiveMap`, ordered by key range. |
| 651 |
/// |
| 652 |
/// The iterator element type is `(RangeInclusive<K>, V)`. |
| 653 |
/// |
| 654 |
/// This `struct` is created by the [`into_iter`] method on [`RangeInclusiveMap`] |
| 655 |
/// (provided by the `IntoIterator` trait). See its documentation for more. |
| 656 |
/// |
| 657 |
/// [`into_iter`]: IntoIterator::into_iter |
| 658 |
pub struct IntoIterrust-analyzer cargo rangemap 1.7.1 inclusive_map/IntoIter#<K, V> { |
| 659 |
innerrust-analyzer cargo rangemap 1.7.1 inclusive_map/IntoIter#inner.: allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::collectionsrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/::btree_maprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree_map/::IntoIterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/IntoIter#<RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>, V>, |
| 660 |
} |
| 661 |
|
| 662 |
impl<K, V> IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator# for RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V> { |
| 663 |
type Itemrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`][IntoIterator]Item# = (RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, V); |
| 664 |
type IntoIterrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`][IntoIterator]IntoIter# = IntoIterrust-analyzer cargo rangemap 1.7.1 inclusive_map/IntoIter#<K, V>; |
| 665 |
fn into_iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`][IntoIterator]into_iter().(self) -> Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`][IntoIterator]::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter# { |
| 666 |
IntoIterrust-analyzer cargo rangemap 1.7.1 inclusive_map/IntoIter# { |
| 667 |
innerrust-analyzer cargo rangemap 1.7.1 inclusive_map/IntoIter#inner.: self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm..into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`][IntoIterator]into_iter().(), |
| 668 |
} |
| 669 |
} |
| 670 |
} |
| 671 |
|
| 672 |
impl<K, V> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for IntoIterrust-analyzer cargo rangemap 1.7.1 inclusive_map/IntoIter#<K, V> { |
| 673 |
type Itemrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`IntoIter<K, V>`][Iterator]Item# = (RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, V); |
| 674 |
fn nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`IntoIter<K, V>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, V)> { |
| 675 |
self.innerrust-analyzer cargo rangemap 1.7.1 inclusive_map/IntoIter#inner. |
| 676 |
.nextrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`IntoIter<K, V, A>`][Iterator]next().() |
| 677 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(by_start, v)| (by_start.end_wrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#end_wrapper..rangerust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#range., v)) |
| 678 |
} |
| 679 |
fn size_hintrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`IntoIter<K, V>`][Iterator]size_hint().(&self) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) { |
| 680 |
self.innerrust-analyzer cargo rangemap 1.7.1 inclusive_map/IntoIter#inner..size_hintrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`IntoIter<K, V, A>`][Iterator]size_hint().() |
| 681 |
} |
| 682 |
} |
| 683 |
|
| 684 |
impl<K, V> DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator# for IntoIterrust-analyzer cargo rangemap 1.7.1 inclusive_map/IntoIter#<K, V> { |
| 685 |
fn next_backrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`IntoIter<K, V>`][DoubleEndedIterator]next_back().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`IntoIter<K, V>`][DoubleEndedIterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 686 |
self.innerrust-analyzer cargo rangemap 1.7.1 inclusive_map/IntoIter#inner. |
| 687 |
.next_backrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`IntoIter<K, V, A>`][DoubleEndedIterator]next_back().() |
| 688 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(range, value)| (range.end_wrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#end_wrapper..rangerust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#range., value)) |
| 689 |
} |
| 690 |
} |
| 691 |
|
| 692 |
// We can't just derive this automatically, because that would |
| 693 |
// expose irrelevant (and private) implementation details. |
| 694 |
// Instead implement it in the same way that the underlying BTreeMap does. |
| 695 |
impl<K: Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, V: Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#> Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V> |
| 696 |
where |
| 697 |
K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + StepLiterust-analyzer cargo rangemap 1.7.1 std_ext/StepLite#, |
| 698 |
V: PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 699 |
{ |
| 700 |
fn fmtrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`][Debug]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 701 |
f.debug_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]debug_map().().entriesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugMap<'a, 'b>`]entries().(self.iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]iter().()).finishrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugMap<'a, 'b>`]finish().() |
| 702 |
} |
| 703 |
} |
| 704 |
|
| 705 |
impl<K, V> FromIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/FromIterator#<(RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, V)> for RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V> |
| 706 |
where |
| 707 |
K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + StepLiterust-analyzer cargo rangemap 1.7.1 std_ext/StepLite#, |
| 708 |
V: PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 709 |
{ |
| 710 |
fn from_iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`][`FromIterator<(RangeInclusive<K>, V)>`]from_iter().<T: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# = (RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, V)>>(iter: T) -> Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`][`FromIterator<(RangeInclusive<K>, V)>`] { |
| 711 |
let mut range_map = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 712 |
range_map.extendrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`][`Extend<(RangeInclusive<K>, V)>`]extend().(iter); |
| 713 |
range_map |
| 714 |
} |
| 715 |
} |
| 716 |
|
| 717 |
impl<K, V> Extendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/Extend#<(RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, V)> for RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V> |
| 718 |
where |
| 719 |
K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + StepLiterust-analyzer cargo rangemap 1.7.1 std_ext/StepLite#, |
| 720 |
V: PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 721 |
{ |
| 722 |
fn extendrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`][`Extend<(RangeInclusive<K>, V)>`]extend().<T: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# = (RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, V)>>(&mut self, iter: T) { |
| 723 |
iter.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().().for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(move |(k, v)| { |
| 724 |
self.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(k, v); |
| 725 |
}) |
| 726 |
} |
| 727 |
} |
| 728 |
|
| 729 |
#[cfg(feature = "serde1")] |
| 730 |
impl<K, V> Serializerust-analyzer cargo serde 1.0.219 ser/Serialize# for RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V> |
| 731 |
where |
| 732 |
K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + StepLiterust-analyzer cargo rangemap 1.7.1 std_ext/StepLite# + Serializerust-analyzer cargo serde 1.0.219 ser/Serialize#, |
| 733 |
V: PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + Serializerust-analyzer cargo serde 1.0.219 ser/Serialize#, |
| 734 |
{ |
| 735 |
fn serializerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`][Serialize]serialize().<S>(&self, serializer: S) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<S::Okrust-analyzer cargo serde 1.0.219 ser/Serializer#Ok#, S::Errorrust-analyzer cargo serde 1.0.219 ser/Serializer#Error#> |
| 736 |
where |
| 737 |
S: Serializerrust-analyzer cargo serde 1.0.219 ser/Serializer#, |
| 738 |
{ |
| 739 |
use serderust-analyzer cargo serde 1.0.219 crate/::serrust-analyzer cargo serde 1.0.219 ser/::SerializeSeqrust-analyzer cargo serde 1.0.219 ser/SerializeSeq#; |
| 740 |
let mut seq = serializer.serialize_seqrust-analyzer cargo serde 1.0.219 ser/Serializer#serialize_seq().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.btmrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#btm..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]len().()))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 741 |
for (k, v) in self.iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]iter().() { |
| 742 |
seq.serialize_elementrust-analyzer cargo serde 1.0.219 ser/SerializeSeq#serialize_element().(&((k.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().(), k.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().()), &v))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 743 |
} |
| 744 |
seq.endrust-analyzer cargo serde 1.0.219 ser/SerializeSeq#end().() |
| 745 |
} |
| 746 |
} |
| 747 |
|
| 748 |
#[cfg(feature = "serde1")] |
| 749 |
impl<'de, K, V> Deserializerust-analyzer cargo serde 1.0.219 de/Deserialize#<'de> for RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V> |
| 750 |
where |
| 751 |
K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + StepLiterust-analyzer cargo rangemap 1.7.1 std_ext/StepLite# + Deserializerust-analyzer cargo serde 1.0.219 de/Deserialize#<'de>, |
| 752 |
V: PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + Deserializerust-analyzer cargo serde 1.0.219 de/Deserialize#<'de>, |
| 753 |
{ |
| 754 |
fn deserializerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`][`Deserialize<'de>`]deserialize().<D>(deserializer: D) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`][`Deserialize<'de>`], D::Errorrust-analyzer cargo serde 1.0.219 de/Deserializer#Error#> |
| 755 |
where |
| 756 |
D: Deserializerrust-analyzer cargo serde 1.0.219 de/Deserializer#<'de>, |
| 757 |
{ |
| 758 |
deserializer.deserialize_seqrust-analyzer cargo serde 1.0.219 de/Deserializer#deserialize_seq().(RangeInclusiveMapVisitorrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMapVisitor#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMapVisitor<K, V>`]new().()) |
| 759 |
} |
| 760 |
} |
| 761 |
|
| 762 |
#[cfg(feature = "serde1")] |
| 763 |
struct RangeInclusiveMapVisitorrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMapVisitor#<K, V> { |
| 764 |
markerrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMapVisitor#marker.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<fn() -> RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V>>, |
| 765 |
} |
| 766 |
|
| 767 |
#[cfg(feature = "serde1")] |
| 768 |
impl<K, V> RangeInclusiveMapVisitorrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMapVisitor#<K, V> { |
| 769 |
fn newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMapVisitor<K, V>`]new().() -> Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMapVisitor<K, V>`] { |
| 770 |
RangeInclusiveMapVisitorrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMapVisitor# { |
| 771 |
markerrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMapVisitor#marker.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 772 |
} |
| 773 |
} |
| 774 |
} |
| 775 |
|
| 776 |
#[cfg(feature = "serde1")] |
| 777 |
impl<'de, K, V> Visitorrust-analyzer cargo serde 1.0.219 de/Visitor#<'de> for RangeInclusiveMapVisitorrust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMapVisitor#<K, V> |
| 778 |
where |
| 779 |
K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + StepLiterust-analyzer cargo rangemap 1.7.1 std_ext/StepLite# + Deserializerust-analyzer cargo serde 1.0.219 de/Deserialize#<'de>, |
| 780 |
V: PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + Deserializerust-analyzer cargo serde 1.0.219 de/Deserialize#<'de>, |
| 781 |
{ |
| 782 |
type Valuerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMapVisitor<K, V>`][`Visitor<'de>`]Value# = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V>; |
| 783 |
|
| 784 |
fn expectingrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMapVisitor<K, V>`][`Visitor<'de>`]expecting().(&self, formatter: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 785 |
formatter.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("RangeInclusiveMap") |
| 786 |
} |
| 787 |
|
| 788 |
fn visit_seqrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMapVisitor<K, V>`][`Visitor<'de>`]visit_seq().<A>(self, mut access: A) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMapVisitor<K, V>`][`Visitor<'de>`]::Valuerust-analyzer cargo serde 1.0.219 de/Visitor#Value#, A::Errorrust-analyzer cargo serde 1.0.219 de/SeqAccess#Error#> |
| 789 |
where |
| 790 |
A: SeqAccessrust-analyzer cargo serde 1.0.219 de/SeqAccess#<'de>, |
| 791 |
{ |
| 792 |
let mut range_inclusive_map = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 793 |
while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(((start, end), value)) = access.next_elementrust-analyzer cargo serde 1.0.219 de/SeqAccess#next_element().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). { |
| 794 |
range_inclusive_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(start..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#end, value); |
| 795 |
} |
| 796 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(range_inclusive_map) |
| 797 |
} |
| 798 |
} |
| 799 |
|
| 800 |
/// An iterator over all ranges not covered by a `RangeInclusiveMap`. |
| 801 |
/// |
| 802 |
/// The iterator element type is `RangeInclusive<K>`. |
| 803 |
/// |
| 804 |
/// This `struct` is created by the [`gaps`] method on [`RangeInclusiveMap`]. See its |
| 805 |
/// documentation for more. |
| 806 |
/// |
| 807 |
/// [`gaps`]: RangeInclusiveMap::gaps |
| 808 |
pub struct Gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#<'a, K, V, StepFnsT> { |
| 809 |
/// Would be redundant, but we need an extra flag to |
| 810 |
/// avoid overflowing when dealing with inclusive ranges. |
| 811 |
/// |
| 812 |
/// All other things here are ignored if `done` is `true`. |
| 813 |
candidate_needs_plus_onerust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#candidate_needs_plus_one.: bool, |
| 814 |
candidate_startrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#candidate_start.: &'a K, |
| 815 |
query_endrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#query_end.: &'a K, |
| 816 |
btm_range_iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#btm_range_iter.: allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::collectionsrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/::btree_maprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree_map/::Rangerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/Range#<'a, RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>, V>, |
| 817 |
_phantomrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#_phantom.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<StepFnsT>, |
| 818 |
} |
| 819 |
|
| 820 |
// `Gaps` is always fused. (See definition of `next` below.) |
| 821 |
impl<'a, K, V, StepFnsT> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator# for Gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#<'a, K, V, StepFnsT> |
| 822 |
where |
| 823 |
K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 824 |
StepFnsT: StepFnsrust-analyzer cargo rangemap 1.7.1 std_ext/StepFns#<K>, |
| 825 |
{ |
| 826 |
} |
| 827 |
|
| 828 |
impl<'a, K, V, StepFnsT> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for Gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#<'a, K, V, StepFnsT> |
| 829 |
where |
| 830 |
K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 831 |
StepFnsT: StepFnsrust-analyzer cargo rangemap 1.7.1 std_ext/StepFns#<K>, |
| 832 |
{ |
| 833 |
type Itemrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]Item# = RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>; |
| 834 |
|
| 835 |
fn nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 836 |
for overlap in self.btm_range_iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#btm_range_iter..by_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#by_ref().() { |
| 837 |
let overlap = overlap.0; |
| 838 |
|
| 839 |
// If the range in the map has advanced beyond the query range, return |
| 840 |
// any tail gap. |
| 841 |
if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self.query_endrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#query_end. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().overlap.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().() { |
| 842 |
break; |
| 843 |
} |
| 844 |
|
| 845 |
let candidate_needs_plus_one = |
| 846 |
corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::replacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/replace().(&mut self.candidate_needs_plus_onerust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#candidate_needs_plus_one., true); |
| 847 |
|
| 848 |
let cur_candidate_start = corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::replacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/replace().(&mut self.candidate_startrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#candidate_start., overlap.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().()); |
| 849 |
|
| 850 |
let cur_candidate_start = if candidate_needs_plus_one { |
| 851 |
StepFnsT::add_onerust-analyzer cargo rangemap 1.7.1 std_ext/StepFns#add_one().(cur_candidate_start) |
| 852 |
} else { |
| 853 |
cur_candidate_start.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() |
| 854 |
}; |
| 855 |
|
| 856 |
if cur_candidate_start rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().overlap.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().() { |
| 857 |
let gap = cur_candidate_start..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#StepFnsT::sub_onerust-analyzer cargo rangemap 1.7.1 std_ext/StepFns#sub_one().(overlap.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().()); |
| 858 |
return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(gap); |
| 859 |
} |
| 860 |
} |
| 861 |
|
| 862 |
// Now that we've run out of items, the only other possible |
| 863 |
// gap is one at the end of the outer range. |
| 864 |
let candidate_needs_plus_one = corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::replacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/replace().(&mut self.candidate_needs_plus_onerust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#candidate_needs_plus_one., true); |
| 865 |
|
| 866 |
let cur_candidate_start = corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::replacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/replace().(&mut self.candidate_startrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#candidate_start., self.query_endrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#query_end.); |
| 867 |
if candidate_needs_plus_one { |
| 868 |
if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().cur_candidate_start rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self.query_endrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#query_end. { |
| 869 |
return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(StepFnsT::add_onerust-analyzer cargo rangemap 1.7.1 std_ext/StepFns#add_one().(cur_candidate_start)..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#self.query_endrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#query_end..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()); |
| 870 |
} |
| 871 |
} else if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().cur_candidate_start rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self.query_endrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#query_end. { |
| 872 |
// There's a gap at the end! |
| 873 |
return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(cur_candidate_start.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#self.query_endrust-analyzer cargo rangemap 1.7.1 inclusive_map/Gaps#query_end..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()); |
| 874 |
} |
| 875 |
|
| 876 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 877 |
} |
| 878 |
} |
| 879 |
|
| 880 |
/// An iterator over all stored ranges partially or completely |
| 881 |
/// overlapped by a given range. |
| 882 |
/// |
| 883 |
/// The iterator element type is `(&'a RangeInclusive<K>, &'a V)`. |
| 884 |
/// |
| 885 |
/// This `struct` is created by the [`overlapping`] method on [`RangeInclusiveMap`]. See its |
| 886 |
/// documentation for more. |
| 887 |
/// |
| 888 |
/// [`overlapping`]: RangeInclusiveMap::overlapping |
| 889 |
pub struct Overlappingrust-analyzer cargo rangemap 1.7.1 inclusive_map/Overlapping#<'a, K, V, R: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>> = &'a RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>> { |
| 890 |
query_rangerust-analyzer cargo rangemap 1.7.1 inclusive_map/Overlapping#query_range.: R, |
| 891 |
btm_range_iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/Overlapping#btm_range_iter.: allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::collectionsrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/::btree_maprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree_map/::Rangerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/Range#<'a, RangeInclusiveStartWrapperrust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveStartWrapper#<K>, V>, |
| 892 |
} |
| 893 |
|
| 894 |
// `Overlapping` is always fused. (See definition of `next` below.) |
| 895 |
impl<'a, K, V, R: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>>> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator# for Overlappingrust-analyzer cargo rangemap 1.7.1 inclusive_map/Overlapping#<'a, K, V, R> where |
| 896 |
K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# |
| 897 |
{ |
| 898 |
} |
| 899 |
|
| 900 |
impl<'a, K, V, R: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>>> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for Overlappingrust-analyzer cargo rangemap 1.7.1 inclusive_map/Overlapping#<'a, K, V, R> |
| 901 |
where |
| 902 |
K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 903 |
{ |
| 904 |
type Itemrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Overlapping<'a, K, V, R>`][Iterator]Item# = (&'a RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, &'a V); |
| 905 |
|
| 906 |
fn nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Overlapping<'a, K, V, R>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Overlapping<'a, K, V, R>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 907 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((k, v)) = self.btm_range_iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/Overlapping#btm_range_iter..nextrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Range<'a, K, V>`][Iterator]next().() { |
| 908 |
if k.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]le().self.query_rangerust-analyzer cargo rangemap 1.7.1 inclusive_map/Overlapping#query_range..borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().().endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().() { |
| 909 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&k.rangerust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#range., v)) |
| 910 |
} else { |
| 911 |
// The rest of the items in the underlying iterator |
| 912 |
// are past the query range. We can keep taking items |
| 913 |
// from that iterator and this will remain true, |
| 914 |
// so this is enough to make the iterator fused. |
| 915 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 916 |
} |
| 917 |
} else { |
| 918 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 919 |
} |
| 920 |
} |
| 921 |
} |
| 922 |
|
| 923 |
impl<'a, K, V, R: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>>> DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator# for Overlappingrust-analyzer cargo rangemap 1.7.1 inclusive_map/Overlapping#<'a, K, V, R> |
| 924 |
where |
| 925 |
K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 926 |
{ |
| 927 |
fn next_backrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Overlapping<'a, K, V, R>`][DoubleEndedIterator]next_back().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Overlapping<'a, K, V, R>`][DoubleEndedIterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 928 |
while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((k, v)) = self.btm_range_iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/Overlapping#btm_range_iter..next_backrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Range<'a, K, V>`][DoubleEndedIterator]next_back().() { |
| 929 |
if k.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]le().self.query_rangerust-analyzer cargo rangemap 1.7.1 inclusive_map/Overlapping#query_range..borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().().endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().() { |
| 930 |
return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&k.rangerust-analyzer cargo rangemap 1.7.1 range_wrapper/RangeInclusiveEndWrapper#range., v)); |
| 931 |
} |
| 932 |
} |
| 933 |
|
| 934 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 935 |
} |
| 936 |
} |
| 937 |
|
| 938 |
impl<K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + StepLiterust-analyzer cargo rangemap 1.7.1 std_ext/StepLite#, V: Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, const N: usize> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<[(RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, V); N]> |
| 939 |
for RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V> |
| 940 |
{ |
| 941 |
fn fromrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`][`From<[(RangeInclusive<K>, V); N]>`]from().(value: [(RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, V); N]) -> Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`][`From<[(RangeInclusive<K>, V); N]>`] { |
| 942 |
let mut map = Selfrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`][`From<[(RangeInclusive<K>, V); N]>`]::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 943 |
for (range, value) in IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#::into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().(value) { |
| 944 |
map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(range, value); |
| 945 |
} |
| 946 |
map |
| 947 |
} |
| 948 |
} |
| 949 |
|
| 950 |
/// Create a [`RangeInclusiveMap`] from key-value pairs. |
| 951 |
/// |
| 952 |
/// # Example |
| 953 |
/// |
| 954 |
/// ```rust |
| 955 |
/// # use rangemap::range_inclusive_map; |
| 956 |
/// let map = range_inclusive_map!{ |
| 957 |
/// 0..=100 => "abc", |
| 958 |
/// 100..=200 => "def", |
| 959 |
/// 200..=300 => "ghi" |
| 960 |
/// }; |
| 961 |
/// ``` |
| 962 |
#[macro_export] |
| 963 |
macro_rules! range_inclusive_maprust-analyzer cargo rangemap 1.7.1 inclusive_map/range_inclusive_map! { |
| 964 |
($($k:expr => $v:expr),* $(,)?) => {{ |
| 965 |
$crate::RangeInclusiveMap::from([$(($k, $v)),*]) |
| 966 |
}}; |
| 967 |
} |
| 968 |
|
| 969 |
#[cfg(test)] |
| 970 |
mod testsrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/ { |
| 971 |
use superrust-analyzer cargo rangemap 1.7.1 inclusive_map/::*; |
| 972 |
use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/ as stdrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/; |
| 973 |
use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::{formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!, 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#, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#}; |
| •974 |
//use proptest::prelude::*; |
| 975 |
//use test_strategy::proptest; |
| 976 |
|
| •977 |
/*impl<K, V> Arbitrary for RangeInclusiveMap<K, V> |
| 978 |
where |
| 979 |
K: Ord + Clone + Debug + StepLite + Arbitrary + 'static, |
| 980 |
V: Clone + PartialEq + Arbitrary + 'static, |
| 981 |
{ |
| 982 |
type Parameters = (); |
| 983 |
type Strategy = BoxedStrategy<Self>; |
| 984 |
|
| 985 |
fn arbitrary_with(_parameters: Self::Parameters) -> Self::Strategy { |
| 986 |
any::<Vec<(RangeInclusive<K>, V)>>() |
| 987 |
.prop_map(|ranges| ranges.into_iter().collect::<RangeInclusiveMap<K, V>>()) |
| 988 |
.boxed() |
| 989 |
} |
| 990 |
} |
| 991 |
|
| 992 |
#[proptest] |
| 993 |
#[allow(clippy::len_zero)] |
| 994 |
fn test_len(mut map: RangeInclusiveMap<u64, String>) { |
| 995 |
assert_eq!(map.len(), map.iter().count()); |
| 996 |
assert_eq!(map.is_empty(), map.len() == 0); |
| 997 |
map.clear(); |
| 998 |
assert_eq!(map.len(), 0); |
| 999 |
assert!(map.is_empty()); |
| 1000 |
assert_eq!(map.iter().count(), 0); |
| 1001 |
} |
| 1002 |
|
| 1003 |
#[proptest] |
| 1004 |
fn test_first(set: RangeInclusiveMap<u64, String>) { |
| 1005 |
assert_eq!( |
| 1006 |
set.first_range_value(), |
| 1007 |
set.iter().min_by_key(|(range, _)| range.start()) |
| 1008 |
); |
| 1009 |
} |
| 1010 |
|
| 1011 |
#[proptest] |
| 1012 |
fn test_last(set: RangeInclusiveMap<u64, String>) { |
| 1013 |
assert_eq!( |
| 1014 |
set.last_range_value(), |
| 1015 |
set.iter().max_by_key(|(range, _)| range.end()) |
| 1016 |
); |
| 1017 |
} |
| 1018 |
|
| 1019 |
#[proptest] |
| 1020 |
fn test_iter_reversible(set: RangeInclusiveMap<u64, String>) { |
| 1021 |
let forward: Vec<_> = set.iter().collect(); |
| 1022 |
let mut backward: Vec<_> = set.iter().rev().collect(); |
| 1023 |
backward.reverse(); |
| 1024 |
assert_eq!(forward, backward); |
| 1025 |
} |
| 1026 |
|
| 1027 |
#[proptest] |
| 1028 |
fn test_into_iter_reversible(set: RangeInclusiveMap<u64, String>) { |
| 1029 |
let forward: Vec<_> = set.clone().into_iter().collect(); |
| 1030 |
let mut backward: Vec<_> = set.into_iter().rev().collect(); |
| 1031 |
backward.reverse(); |
| 1032 |
assert_eq!(forward, backward); |
| 1033 |
} |
| 1034 |
|
| 1035 |
#[proptest] |
| 1036 |
fn test_overlapping_reversible( |
| 1037 |
set: RangeInclusiveMap<u64, String>, |
| 1038 |
range: RangeInclusive<u64>, |
| 1039 |
) { |
| 1040 |
let forward: Vec<_> = set.overlapping(&range).collect(); |
| 1041 |
let mut backward: Vec<_> = set.overlapping(&range).rev().collect(); |
| 1042 |
backward.reverse(); |
| 1043 |
assert_eq!(forward, backward); |
| 1044 |
} |
| 1045 |
|
| 1046 |
#[proptest] |
| 1047 |
fn test_arbitrary_map_u8(ranges: Vec<(RangeInclusive<u8>, String)>) { |
| 1048 |
let ranges: Vec<_> = ranges |
| 1049 |
.into_iter() |
| 1050 |
.filter(|(range, _value)| range.start() != range.end()) |
| 1051 |
.collect(); |
| 1052 |
let set = ranges |
| 1053 |
.iter() |
| 1054 |
.fold(RangeInclusiveMap::new(), |mut set, (range, value)| { |
| 1055 |
set.insert(range.clone(), value.clone()); |
| 1056 |
set |
| 1057 |
}); |
| 1058 |
|
| 1059 |
for value in 0..u8::MAX { |
| 1060 |
assert_eq!( |
| 1061 |
set.get(&value), |
| 1062 |
ranges |
| 1063 |
.iter() |
| 1064 |
.rev() |
| 1065 |
.find(|(range, _value)| range.contains(&value)) |
| 1066 |
.map(|(_range, value)| value) |
| 1067 |
); |
| 1068 |
} |
| 1069 |
} |
| 1070 |
|
| 1071 |
#[proptest] |
| 1072 |
#[allow(deprecated)] |
| 1073 |
fn test_hash(left: RangeInclusiveMap<u64, u64>, right: RangeInclusiveMap<u64, u64>) { |
| 1074 |
use core::hash::{Hash, Hasher, SipHasher}; |
| 1075 |
|
| 1076 |
let hash = |set: &RangeInclusiveMap<_, _>| { |
| 1077 |
let mut hasher = SipHasher::new(); |
| 1078 |
set.hash(&mut hasher); |
| 1079 |
hasher.finish() |
| 1080 |
}; |
| 1081 |
|
| 1082 |
if left == right { |
| 1083 |
assert!( |
| 1084 |
hash(&left) == hash(&right), |
| 1085 |
"if two values are equal, their hash must be equal" |
| 1086 |
); |
| 1087 |
} |
| 1088 |
|
| 1089 |
// if the hashes are equal the values might not be the same (collision) |
| 1090 |
if hash(&left) != hash(&right) { |
| 1091 |
assert!( |
| 1092 |
left != right, |
| 1093 |
"if two value's hashes are not equal, they must not be equal" |
| 1094 |
); |
| 1095 |
} |
| 1096 |
} |
| 1097 |
|
| 1098 |
#[proptest] |
| 1099 |
fn test_ord(left: RangeInclusiveMap<u64, u64>, right: RangeInclusiveMap<u64, u64>) { |
| 1100 |
assert_eq!( |
| 1101 |
left == right, |
| 1102 |
left.cmp(&right).is_eq(), |
| 1103 |
"ordering and equality must match" |
| 1104 |
); |
| 1105 |
assert_eq!( |
| 1106 |
left.cmp(&right), |
| 1107 |
left.partial_cmp(&right).unwrap(), |
| 1108 |
"ordering is total for ordered parameters" |
| 1109 |
); |
| •1110 |
}*/ |
| 1111 |
|
| 1112 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1113 |
fn test_from_arrayrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/test_from_array().() { |
| 1114 |
let mut map = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1115 |
map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#100, "hello"); |
| 1116 |
map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(200..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#300, "world"); |
| 1117 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1118 |
map, |
| 1119 |
RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::fromrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`][`From<[(RangeInclusive<K>, V); N]>`]from().([(0..=100, "hello"), (200..=300, "world")]) |
| 1120 |
); |
| 1121 |
} |
| 1122 |
|
| 1123 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1124 |
fn test_macrorust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/test_macro().() { |
| 1125 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1126 |
range_inclusive_maprust-analyzer cargo rangemap 1.7.1 inclusive_map/range_inclusive_map!![], |
| 1127 |
RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::<i64, i64>::defaultrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`][Default]default().() |
| 1128 |
); |
| 1129 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1130 |
range_inclusive_maprust-analyzer cargo rangemap 1.7.1 inclusive_map/range_inclusive_map!!(0..=100 => "abc", 100..=200 => "def", 200..=300 => "ghi"), |
| 1131 |
[(0..=100, "abc"), (100..=200, "def"), (200..=300, "ghi")] |
| 1132 |
.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 1133 |
.clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().() |
| 1134 |
.collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 1135 |
); |
| 1136 |
} |
| 1137 |
|
| 1138 |
trait RangeInclusiveMapExtrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/RangeInclusiveMapExt#<K, V> { |
| 1139 |
fn to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/RangeInclusiveMapExt#to_vec().(&self) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, V)>; |
| 1140 |
} |
| 1141 |
|
| 1142 |
impl<K, V> RangeInclusiveMapExtrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/RangeInclusiveMapExt#<K, V> for RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<K, V, K> |
| 1143 |
where |
| 1144 |
K: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + StepLiterust-analyzer cargo rangemap 1.7.1 std_ext/StepLite#, |
| 1145 |
V: PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 1146 |
{ |
| 1147 |
fn to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(&self) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<K>, V)> { |
| 1148 |
self.iterrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(kr, v)| (kr.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`][Clone]clone().(), v.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().())).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 1149 |
} |
| 1150 |
} |
| 1151 |
|
| 1152 |
// |
| 1153 |
// Insertion tests |
| 1154 |
// |
| 1155 |
|
| 1156 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1157 |
fn empty_map_is_emptyrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/empty_map_is_empty().() { |
| 1158 |
let range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1159 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]); |
| 1160 |
} |
| 1161 |
|
| 1162 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1163 |
fn insert_into_empty_maprust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/insert_into_empty_map().() { |
| 1164 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1165 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#50, false); |
| 1166 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(0..=50, false)]); |
| 1167 |
} |
| 1168 |
|
| 1169 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1170 |
fn new_same_value_immediately_following_storedrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/new_same_value_immediately_following_stored().() { |
| 1171 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1172 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1173 |
// ◌ ●---● ◌ ◌ ◌ ◌ ◌ ◌ |
| 1174 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#3, false); |
| 1175 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1176 |
// ◌ ◌ ◌ ◌ ●---◌ ◌ ◌ ◌ |
| 1177 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(4..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#6, false); |
| 1178 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1179 |
// ◌ ●---------◌ ◌ ◌ ◌ |
| 1180 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1..=6, false)]); |
| 1181 |
} |
| 1182 |
|
| 1183 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1184 |
fn new_different_value_immediately_following_storedrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/new_different_value_immediately_following_stored().() { |
| 1185 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1186 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1187 |
// ◌ ●---● ◌ ◌ ◌ ◌ ◌ ◌ |
| 1188 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#3, false); |
| 1189 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1190 |
// ◌ ◌ ◌ ◌ ◆---◇ ◌ ◌ ◌ |
| 1191 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(4..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#6, true); |
| 1192 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1193 |
// ◌ ●---● ◌ ◌ ◌ ◌ ◌ ◌ |
| 1194 |
// ◌ ◌ ◌ ◌ ◆---◇ ◌ ◌ ◌ |
| 1195 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1..=3, false), (4..=6, true)]); |
| 1196 |
} |
| 1197 |
|
| 1198 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1199 |
fn new_same_value_overlapping_end_of_storedrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/new_same_value_overlapping_end_of_stored().() { |
| 1200 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1201 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1202 |
// ◌ ●-----● ◌ ◌ ◌ ◌ ◌ |
| 1203 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#4, false); |
| 1204 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1205 |
// ◌ ◌ ◌ ◌ ●---● ◌ ◌ ◌ |
| 1206 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(4..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#6, false); |
| 1207 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1208 |
// ◌ ●---------● ◌ ◌ ◌ |
| 1209 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1..=6, false)]); |
| 1210 |
} |
| 1211 |
|
| 1212 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1213 |
fn new_different_value_overlapping_end_of_storedrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/new_different_value_overlapping_end_of_stored().() { |
| 1214 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1215 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1216 |
// ◌ ●---● ◌ ◌ ◌ ◌ ◌ ◌ |
| 1217 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#3, false); |
| 1218 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1219 |
// ◌ ◌ ◌ ◆---◆ ◌ ◌ ◌ ◌ |
| 1220 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(3..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5, true); |
| 1221 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1222 |
// ◌ ●-● ◌ ◌ ◌ ◌ ◌ ◌ ◌ |
| 1223 |
// ◌ ◌ ◌ ◆---◇ ◌ ◌ ◌ ◌ |
| 1224 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1..=2, false), (3..=5, true)]); |
| 1225 |
} |
| 1226 |
|
| 1227 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1228 |
fn new_same_value_immediately_preceding_storedrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/new_same_value_immediately_preceding_stored().() { |
| 1229 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1230 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1231 |
// ◌ ◌ ◌ ●---● ◌ ◌ ◌ ◌ |
| 1232 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(3..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5, false); |
| 1233 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1234 |
// ◌ ●-● ◌ ◌ ◌ ◌ ◌ ◌ ◌ |
| 1235 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#2, false); |
| 1236 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1237 |
// ◌ ●-------● ◌ ◌ ◌ ◌ |
| 1238 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1..=5, false)]); |
| 1239 |
} |
| 1240 |
|
| 1241 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1242 |
fn new_different_value_immediately_preceding_storedrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/new_different_value_immediately_preceding_stored().() { |
| 1243 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1244 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1245 |
// ◌ ◌ ◌ ◆---◆ ◌ ◌ ◌ ◌ |
| 1246 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(3..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5, true); |
| 1247 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1248 |
// ◌ ●-● ◌ ◌ ◌ ◌ ◌ ◌ ◌ |
| 1249 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#2, false); |
| 1250 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1251 |
// ◌ ●-● ◌ ◌ ◌ ◌ ◌ ◌ ◌ |
| 1252 |
// ◌ ◌ ◌ ◆---◇ ◌ ◌ ◌ ◌ |
| 1253 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1..=2, false), (3..=5, true)]); |
| 1254 |
} |
| 1255 |
|
| 1256 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1257 |
fn new_same_value_wholly_inside_storedrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/new_same_value_wholly_inside_stored().() { |
| 1258 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1259 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1260 |
// ◌ ●-------● ◌ ◌ ◌ ◌ |
| 1261 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5, false); |
| 1262 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1263 |
// ◌ ◌ ●---● ◌ ◌ ◌ ◌ ◌ ◌ |
| 1264 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(2..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#4, false); |
| 1265 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1266 |
// ◌ ●-------● ◌ ◌ ◌ ◌ |
| 1267 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1..=5, false)]); |
| 1268 |
} |
| 1269 |
|
| 1270 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1271 |
fn new_different_value_wholly_inside_storedrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/new_different_value_wholly_inside_stored().() { |
| 1272 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1273 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1274 |
// ◌ ◆-------◆ ◌ ◌ ◌ ◌ |
| 1275 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5, true); |
| 1276 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1277 |
// ◌ ◌ ●---● ◌ ◌ ◌ ◌ ◌ ◌ |
| 1278 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(2..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#4, false); |
| 1279 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1280 |
// ◌ ◆ ◌ ◌ ◌ ◌ ◌ ◌ ◌ ◌ |
| 1281 |
// ◌ ◌ ●---● ◌ ◌ ◌ ◌ ◌ |
| 1282 |
// ◌ ◌ ◌ ◌ ◌ ◆ ◌ ◌ ◌ ◌ |
| 1283 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1284 |
range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), |
| 1285 |
vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1..=1, true), (2..=4, false), (5..=5, true)] |
| 1286 |
); |
| 1287 |
} |
| 1288 |
|
| 1289 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1290 |
fn replace_at_end_of_existing_range_should_coalescerust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/replace_at_end_of_existing_range_should_coalesce().() { |
| 1291 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1292 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1293 |
// ◌ ●---● ◌ ◌ ◌ ◌ ◌ ◌ |
| 1294 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#3, false); |
| 1295 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1296 |
// ◌ ◌ ◌ ◌ ●---● ◌ ◌ ◌ |
| 1297 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(4..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#6, true); |
| 1298 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1299 |
// ◌ ◌ ◌ ◌ ●---● ◌ ◌ ◌ |
| 1300 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(4..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#6, false); |
| 1301 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1302 |
// ◌ ●---------● ◌ ◌ ◌ |
| 1303 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1..=6, false)]); |
| 1304 |
} |
| 1305 |
|
| •1306 |
/*#[test] |
| 1307 |
// Test every permutation of a bunch of touching and overlapping ranges. |
| 1308 |
fn lots_of_interesting_ranges() { |
| 1309 |
use crate::dense::DenseU32RangeMap; |
| 1310 |
use permutator::Permutation; |
| 1311 |
|
| 1312 |
let mut ranges_with_values = [ |
| 1313 |
(2..=3, false), |
| 1314 |
// A duplicate range |
| 1315 |
(2..=3, false), |
| 1316 |
// Almost a duplicate, but with a different value |
| 1317 |
(2..=3, true), |
| 1318 |
// A few small ranges, some of them overlapping others, |
| 1319 |
// some of them touching others |
| 1320 |
(3..=5, true), |
| 1321 |
(4..=6, true), |
| 1322 |
(6..=7, true), |
| 1323 |
// A really big range |
| 1324 |
(2..=6, true), |
| 1325 |
]; |
| 1326 |
|
| 1327 |
ranges_with_values.permutation().for_each(|permutation| { |
| 1328 |
let mut range_map: RangeInclusiveMap<u32, bool> = RangeInclusiveMap::new(); |
| 1329 |
let mut dense: DenseU32RangeMap<bool> = DenseU32RangeMap::new(); |
| 1330 |
|
| 1331 |
for (k, v) in permutation { |
| 1332 |
// Insert it into both maps. |
| 1333 |
range_map.insert(k.clone(), v); |
| 1334 |
dense.insert(k, v); |
| 1335 |
|
| 1336 |
// At every step, both maps should contain the same stuff. |
| 1337 |
let sparse = range_map.to_vec(); |
| 1338 |
let dense = dense.to_vec(); |
| 1339 |
assert_eq!(sparse, dense); |
| 1340 |
} |
| 1341 |
}); |
| •1342 |
}*/ |
| 1343 |
|
| 1344 |
// |
| 1345 |
// Get* tests |
| 1346 |
// |
| 1347 |
|
| 1348 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1349 |
fn getrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/get().() { |
| 1350 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1351 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#50, false); |
| 1352 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.getrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]get().(&50), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&false)); |
| 1353 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.getrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]get().(&51), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1354 |
} |
| 1355 |
|
| 1356 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1357 |
fn get_key_valuerust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/get_key_value().() { |
| 1358 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1359 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#50, false); |
| 1360 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.get_key_valuerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]get_key_value().(&50), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&(0..=50), &false))); |
| 1361 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.get_key_valuerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]get_key_value().(&51), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1362 |
} |
| 1363 |
|
| 1364 |
// |
| 1365 |
// Removal tests |
| 1366 |
// |
| 1367 |
|
| 1368 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1369 |
fn remove_from_empty_maprust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/remove_from_empty_map().() { |
| 1370 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1371 |
range_map.removerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]remove().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#50); |
| 1372 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]); |
| 1373 |
} |
| 1374 |
|
| 1375 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1376 |
fn remove_non_covered_range_before_storedrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/remove_non_covered_range_before_stored().() { |
| 1377 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1378 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(25..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#75, false); |
| 1379 |
range_map.removerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]remove().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#24); |
| 1380 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(25..=75, false)]); |
| 1381 |
} |
| 1382 |
|
| 1383 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1384 |
fn remove_non_covered_range_after_storedrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/remove_non_covered_range_after_stored().() { |
| 1385 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1386 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(25..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#75, false); |
| 1387 |
range_map.removerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]remove().(76..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#100); |
| 1388 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(25..=75, false)]); |
| 1389 |
} |
| 1390 |
|
| 1391 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1392 |
fn remove_overlapping_start_of_storedrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/remove_overlapping_start_of_stored().() { |
| 1393 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1394 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(25..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#75, false); |
| 1395 |
range_map.removerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]remove().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#25); |
| 1396 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(26..=75, false)]); |
| 1397 |
} |
| 1398 |
|
| 1399 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1400 |
fn remove_middle_of_storedrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/remove_middle_of_stored().() { |
| 1401 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1402 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(25..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#75, false); |
| 1403 |
range_map.removerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]remove().(30..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#70); |
| 1404 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(25..=29, false), (71..=75, false)]); |
| 1405 |
} |
| 1406 |
|
| 1407 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1408 |
fn remove_overlapping_end_of_storedrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/remove_overlapping_end_of_stored().() { |
| 1409 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1410 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(25..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#75, false); |
| 1411 |
range_map.removerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]remove().(75..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#100); |
| 1412 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(25..=74, false)]); |
| 1413 |
} |
| 1414 |
|
| 1415 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1416 |
fn remove_exactly_storedrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/remove_exactly_stored().() { |
| 1417 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1418 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(25..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#75, false); |
| 1419 |
range_map.removerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]remove().(25..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#75); |
| 1420 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]); |
| 1421 |
} |
| 1422 |
|
| 1423 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1424 |
fn remove_superset_of_storedrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/remove_superset_of_stored().() { |
| 1425 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1426 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(25..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#75, false); |
| 1427 |
range_map.removerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]remove().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#100); |
| 1428 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(range_map.to_vecrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/impl#[`RangeInclusiveMap<K, V>`][`RangeInclusiveMapExt<K, V>`]to_vec().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]); |
| 1429 |
} |
| 1430 |
|
| 1431 |
// |
| 1432 |
// Test extremes of key ranges; we do addition/subtraction in |
| 1433 |
// the range domain so I want to make sure I haven't accidentally |
| 1434 |
// introduced some arithmetic overflow there. |
| 1435 |
// |
| 1436 |
|
| 1437 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1438 |
fn no_overflow_at_key_domain_extremesrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/no_overflow_at_key_domain_extremes().() { |
| 1439 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u8, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1440 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#255, false); |
| 1441 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#10, true); |
| 1442 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(245..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#255, true); |
| 1443 |
range_map.removerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]remove().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5); |
| 1444 |
range_map.removerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]remove().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5); |
| 1445 |
range_map.removerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]remove().(250..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#255); |
| 1446 |
range_map.removerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]remove().(250..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#255); |
| 1447 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#255, true); |
| 1448 |
range_map.removerust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]remove().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#254); |
| 1449 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(254..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#254, true); |
| 1450 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(255..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#255, true); |
| 1451 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(255..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#255, false); |
| 1452 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#0, false); |
| 1453 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#1, true); |
| 1454 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#0, true); |
| 1455 |
} |
| 1456 |
|
| 1457 |
// Gaps tests |
| 1458 |
|
| 1459 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1460 |
fn whole_range_is_a_gaprust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/whole_range_is_a_gap().() { |
| 1461 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1462 |
// ◌ ◌ ◌ ◌ ◌ ◌ ◌ ◌ ◌ ◌ |
| 1463 |
let range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1464 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1465 |
// ◌ ◆-------------◆ ◌ |
| 1466 |
let outer_range = 1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#8; |
| 1467 |
let mut gaps = range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&outer_range); |
| 1468 |
// Should yield the entire outer range. |
| 1469 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1..=8)); |
| 1470 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1471 |
// Gaps iterator should be fused. |
| 1472 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1473 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1474 |
} |
| 1475 |
|
| 1476 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1477 |
fn whole_range_is_covered_exactlyrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/whole_range_is_covered_exactly().() { |
| 1478 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1479 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1480 |
// ◌ ●---------● ◌ ◌ ◌ |
| 1481 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#6, ()); |
| 1482 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1483 |
// ◌ ◆---------◆ ◌ ◌ ◌ |
| 1484 |
let outer_range = 1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#6; |
| 1485 |
let mut gaps = range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&outer_range); |
| 1486 |
// Should yield no gaps. |
| 1487 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1488 |
// Gaps iterator should be fused. |
| 1489 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1490 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1491 |
} |
| 1492 |
|
| 1493 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1494 |
fn item_before_outer_rangerust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/item_before_outer_range().() { |
| 1495 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1496 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1497 |
// ◌ ●---● ◌ ◌ ◌ ◌ ◌ ◌ |
| 1498 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#3, ()); |
| 1499 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1500 |
// ◌ ◌ ◌ ◌ ◌ ◆-----◆ ◌ |
| 1501 |
let outer_range = 5..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#8; |
| 1502 |
let mut gaps = range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&outer_range); |
| 1503 |
// Should yield the entire outer range. |
| 1504 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(5..=8)); |
| 1505 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1506 |
// Gaps iterator should be fused. |
| 1507 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1508 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1509 |
} |
| 1510 |
|
| 1511 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1512 |
fn item_touching_start_of_outer_rangerust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/item_touching_start_of_outer_range().() { |
| 1513 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1514 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1515 |
// ◌ ●-----● ◌ ◌ ◌ ◌ ◌ |
| 1516 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#4, ()); |
| 1517 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1518 |
// ◌ ◌ ◌ ◌ ◌ ◆-----◆ ◌ |
| 1519 |
let outer_range = 5..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#8; |
| 1520 |
let mut gaps = range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&outer_range); |
| 1521 |
// Should yield the entire outer range. |
| 1522 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(5..=8)); |
| 1523 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1524 |
// Gaps iterator should be fused. |
| 1525 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1526 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1527 |
} |
| 1528 |
|
| 1529 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1530 |
fn item_overlapping_start_of_outer_rangerust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/item_overlapping_start_of_outer_range().() { |
| 1531 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1532 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1533 |
// ◌ ●-------● ◌ ◌ ◌ ◌ |
| 1534 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5, ()); |
| 1535 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1536 |
// ◌ ◌ ◌ ◌ ◌ ◆-----◆ ◌ |
| 1537 |
let outer_range = 5..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#8; |
| 1538 |
let mut gaps = range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&outer_range); |
| 1539 |
// Should yield from just past the end of the stored item |
| 1540 |
// to the end of the outer range. |
| 1541 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(6..=8)); |
| 1542 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1543 |
// Gaps iterator should be fused. |
| 1544 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1545 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1546 |
} |
| 1547 |
|
| 1548 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1549 |
fn item_starting_at_start_of_outer_rangerust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/item_starting_at_start_of_outer_range().() { |
| 1550 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1551 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1552 |
// ◌ ◌ ◌ ◌ ◌ ●-● ◌ ◌ ◌ |
| 1553 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(5..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#6, ()); |
| 1554 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1555 |
// ◌ ◌ ◌ ◌ ◌ ◆-----◆ ◌ |
| 1556 |
let outer_range = 5..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#8; |
| 1557 |
let mut gaps = range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&outer_range); |
| 1558 |
// Should yield from just past the item onwards. |
| 1559 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(7..=8)); |
| 1560 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1561 |
// Gaps iterator should be fused. |
| 1562 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1563 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1564 |
} |
| 1565 |
|
| 1566 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1567 |
fn items_floating_inside_outer_rangerust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/items_floating_inside_outer_range().() { |
| 1568 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1569 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1570 |
// ◌ ◌ ◌ ◌ ◌ ◌ ●-● ◌ ◌ |
| 1571 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(6..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#7, ()); |
| 1572 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1573 |
// ◌ ◌ ◌ ●-● ◌ ◌ ◌ ◌ ◌ |
| 1574 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(3..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#4, ()); |
| 1575 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1576 |
// ◌ ◆-------------◆ ◌ |
| 1577 |
let outer_range = 1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#8; |
| 1578 |
let mut gaps = range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&outer_range); |
| 1579 |
// Should yield gaps at start, between items, |
| 1580 |
// and at end. |
| 1581 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1..=2)); |
| 1582 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(5..=5)); |
| 1583 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(8..=8)); |
| 1584 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1585 |
// Gaps iterator should be fused. |
| 1586 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1587 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1588 |
} |
| 1589 |
|
| 1590 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1591 |
fn item_ending_at_end_of_outer_rangerust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/item_ending_at_end_of_outer_range().() { |
| 1592 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1593 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1594 |
// ◌ ◌ ◌ ◌ ◌ ◌ ◌ ●-● ◌ |
| 1595 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(7..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#8, ()); |
| 1596 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1597 |
// ◌ ◌ ◌ ◌ ◌ ◆-----◆ ◌ |
| 1598 |
let outer_range = 5..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#8; |
| 1599 |
let mut gaps = range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&outer_range); |
| 1600 |
// Should yield from the start of the outer range |
| 1601 |
// up to just before the start of the stored item. |
| 1602 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(5..=6)); |
| 1603 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1604 |
// Gaps iterator should be fused. |
| 1605 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1606 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1607 |
} |
| 1608 |
|
| 1609 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1610 |
fn item_overlapping_end_of_outer_rangerust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/item_overlapping_end_of_outer_range().() { |
| 1611 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1612 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1613 |
// ◌ ◌ ◌ ◌ ◌ ●---● ◌ ◌ |
| 1614 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(5..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#6, ()); |
| 1615 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1616 |
// ◌ ◌ ◆-----◆ ◌ ◌ ◌ ◌ |
| 1617 |
let outer_range = 2..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5; |
| 1618 |
let mut gaps = range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&outer_range); |
| 1619 |
// Should yield from the start of the outer range |
| 1620 |
// up to the start of the stored item. |
| 1621 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(2..=4)); |
| 1622 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1623 |
// Gaps iterator should be fused. |
| 1624 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1625 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1626 |
} |
| 1627 |
|
| 1628 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1629 |
fn item_touching_end_of_outer_rangerust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/item_touching_end_of_outer_range().() { |
| 1630 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1631 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1632 |
// ◌ ◌ ◌ ◌ ◌ ●-----● ◌ |
| 1633 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(5..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#9, ()); |
| 1634 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1635 |
// ◌ ◆-----◆ ◌ ◌ ◌ ◌ ◌ |
| 1636 |
let outer_range = 1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#4; |
| 1637 |
let mut gaps = range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&outer_range); |
| 1638 |
// Should yield the entire outer range. |
| 1639 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1..=4)); |
| 1640 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1641 |
// Gaps iterator should be fused. |
| 1642 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1643 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1644 |
} |
| 1645 |
|
| 1646 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1647 |
fn item_after_outer_rangerust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/item_after_outer_range().() { |
| 1648 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1649 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1650 |
// ◌ ◌ ◌ ◌ ◌ ◌ ●---● ◌ |
| 1651 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(6..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#7, ()); |
| 1652 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1653 |
// ◌ ◆-----◆ ◌ ◌ ◌ ◌ ◌ |
| 1654 |
let outer_range = 1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#4; |
| 1655 |
let mut gaps = range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&outer_range); |
| 1656 |
// Should yield the entire outer range. |
| 1657 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1..=4)); |
| 1658 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1659 |
// Gaps iterator should be fused. |
| 1660 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1661 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1662 |
} |
| 1663 |
|
| 1664 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1665 |
fn zero_width_outer_range_with_items_away_from_both_sidesrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/zero_width_outer_range_with_items_away_from_both_sides().() { |
| 1666 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1667 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1668 |
// ◌ ◆---◆ ◌ ◌ ◌ ◌ ◌ ◌ |
| 1669 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#3, ()); |
| 1670 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1671 |
// ◌ ◌ ◌ ◌ ◌ ◆---◆ ◌ ◌ |
| 1672 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(5..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#7, ()); |
| 1673 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1674 |
// ◌ ◌ ◌ ◌ ◆ ◌ ◌ ◌ ◌ ◌ |
| 1675 |
let outer_range = 4..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#4; |
| 1676 |
let mut gaps = range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&outer_range); |
| 1677 |
// Should yield a zero-width gap. |
| 1678 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(4..=4)); |
| 1679 |
// Gaps iterator should be fused. |
| 1680 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1681 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1682 |
} |
| 1683 |
|
| 1684 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1685 |
fn zero_width_outer_range_with_items_touching_both_sidesrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/zero_width_outer_range_with_items_touching_both_sides().() { |
| 1686 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1687 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1688 |
// ◌ ◌ ◆-◆ ◌ ◌ ◌ ◌ ◌ ◌ ◌ |
| 1689 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(2..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#3, ()); |
| 1690 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1691 |
// ◌ ◌ ◌ ◌ ◌ ◆---◆ ◌ ◌ ◌ |
| 1692 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(5..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#6, ()); |
| 1693 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1694 |
// ◌ ◌ ◌ ◌ ◆ ◌ ◌ ◌ ◌ ◌ |
| 1695 |
let outer_range = 4..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#4; |
| 1696 |
let mut gaps = range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&outer_range); |
| 1697 |
// Should yield no gaps. |
| 1698 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(4..=4)); |
| 1699 |
// Gaps iterator should be fused. |
| 1700 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1701 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1702 |
} |
| 1703 |
|
| 1704 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1705 |
fn empty_outer_range_with_item_straddlingrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/empty_outer_range_with_item_straddling().() { |
| 1706 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1707 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1708 |
// ◌ ◌ ◆-----◆ ◌ ◌ ◌ ◌ ◌ |
| 1709 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(2..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5, ()); |
| 1710 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1711 |
// ◌ ◌ ◌ ◌ ◆ ◌ ◌ ◌ ◌ ◌ |
| 1712 |
let outer_range = 4..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#4; |
| 1713 |
let mut gaps = range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&outer_range); |
| 1714 |
// Should yield no gaps. |
| 1715 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1716 |
// Gaps iterator should be fused. |
| 1717 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1718 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1719 |
} |
| 1720 |
|
| 1721 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1722 |
fn no_empty_gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/no_empty_gaps().() { |
| 1723 |
// Make two ranges different values so they don't |
| 1724 |
// get coalesced. |
| 1725 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1726 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1727 |
// ◌ ◌ ◌ ◌ ◆-◆ ◌ ◌ ◌ ◌ |
| 1728 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(4..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5, true); |
| 1729 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1730 |
// ◌ ◌ ◆-◆ ◌ ◌ ◌ ◌ ◌ ◌ |
| 1731 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(2..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#3, false); |
| 1732 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1733 |
// ◌ ●-------------● ◌ |
| 1734 |
let outer_range = 1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#8; |
| 1735 |
let mut gaps = range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&outer_range); |
| 1736 |
// Should yield gaps at start and end, but not between the |
| 1737 |
// two touching items. |
| 1738 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1..=1)); |
| 1739 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(6..=8)); |
| 1740 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1741 |
// Gaps iterator should be fused. |
| 1742 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1743 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1744 |
} |
| 1745 |
|
| 1746 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1747 |
fn no_overflow_finding_gaps_at_key_domain_extremesrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/no_overflow_finding_gaps_at_key_domain_extremes().() { |
| 1748 |
// Items and outer range both at extremes. |
| 1749 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u8, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1750 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#255, false); |
| 1751 |
range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#255)); |
| 1752 |
|
| 1753 |
// Items at extremes with gaps in middle. |
| 1754 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u8, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1755 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#255, false); |
| 1756 |
range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5)); |
| 1757 |
range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&(250..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#255)); |
| 1758 |
|
| 1759 |
// Items just in from extremes. |
| 1760 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u8, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1761 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#255, false); |
| 1762 |
range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5)); |
| 1763 |
range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&(250..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#254)); |
| 1764 |
|
| 1765 |
// Outer range just in from extremes, |
| 1766 |
// items at extremes. |
| 1767 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u8, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1768 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#254, false); |
| 1769 |
range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5)); |
| 1770 |
range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&(250..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#255)); |
| 1771 |
} |
| 1772 |
|
| 1773 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1774 |
fn adjacent_unit_width_itemsrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/adjacent_unit_width_items().() { |
| 1775 |
// Items two items next to each other at the start, and at the end. |
| 1776 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u8, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1777 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#0, false); |
| 1778 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#1, true); |
| 1779 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(254..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#254, false); |
| 1780 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(255..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#255, true); |
| 1781 |
|
| 1782 |
let outer_range = 0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#255; |
| 1783 |
let mut gaps = range_map.gapsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]gaps().(&outer_range); |
| 1784 |
// Should yield one big gap in the middle. |
| 1785 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(2..=253)); |
| 1786 |
// Gaps iterator should be fused. |
| 1787 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1788 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(gaps.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Gaps<'a, K, V, StepFnsT>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1789 |
} |
| 1790 |
|
| 1791 |
// Overlapping tests |
| 1792 |
|
| 1793 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1794 |
fn overlapping_ref_with_empty_maprust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/overlapping_ref_with_empty_map().() { |
| 1795 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1796 |
// ◌ ◌ ◌ ◌ ◌ ◌ ◌ ◌ ◌ ◌ |
| 1797 |
let range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1798 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1799 |
// ◌ ◆-------------◆ ◌ |
| 1800 |
let query_range = 1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#8; |
| 1801 |
let mut overlapping = range_map.overlappingrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]overlapping().(&query_range); |
| 1802 |
// Should not yield any items. |
| 1803 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(overlapping.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Overlapping<'a, K, V, R>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1804 |
// Gaps iterator should be fused. |
| 1805 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(overlapping.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Overlapping<'a, K, V, R>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1806 |
} |
| 1807 |
|
| 1808 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1809 |
fn overlapping_owned_with_empty_maprust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/overlapping_owned_with_empty_map().() { |
| 1810 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1811 |
// ◌ ◌ ◌ ◌ ◌ ◌ ◌ ◌ ◌ ◌ |
| 1812 |
let range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1813 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1814 |
// ◌ ◆-------------◆ ◌ |
| 1815 |
let query_range = 1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#8; |
| 1816 |
let mut overlapping = range_map.overlappingrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]overlapping().(query_range); |
| 1817 |
// Should not yield any items. |
| 1818 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(overlapping.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Overlapping<'a, K, V, R>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1819 |
// Gaps iterator should be fused. |
| 1820 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(overlapping.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Overlapping<'a, K, V, R>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1821 |
} |
| 1822 |
|
| 1823 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1824 |
fn overlapping_partial_edges_complete_middlerust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/overlapping_partial_edges_complete_middle().() { |
| 1825 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1826 |
|
| 1827 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1828 |
// ●-● ◌ ◌ ◌ ◌ ◌ ◌ ◌ ◌ |
| 1829 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#1, ()); |
| 1830 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1831 |
// ◌ ◌ ◌ ●-● ◌ ◌ ◌ ◌ ◌ |
| 1832 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(3..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#4, ()); |
| 1833 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1834 |
// ◌ ◌ ◌ ◌ ◌ ◌ ●-● ◌ ◌ |
| 1835 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(6..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#7, ()); |
| 1836 |
|
| 1837 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1838 |
// ◌ ◆---------◆ ◌ ◌ ◌ |
| 1839 |
let query_range = 1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#6; |
| 1840 |
|
| 1841 |
let mut overlapping = range_map.overlappingrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]overlapping().(&query_range); |
| 1842 |
|
| 1843 |
// Should yield partially overlapped range at start. |
| 1844 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(overlapping.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Overlapping<'a, K, V, R>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&(0..=1), &()))); |
| 1845 |
// Should yield completely overlapped range in middle. |
| 1846 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(overlapping.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Overlapping<'a, K, V, R>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&(3..=4), &()))); |
| 1847 |
// Should yield partially overlapped range at end. |
| 1848 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(overlapping.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Overlapping<'a, K, V, R>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&(6..=7), &()))); |
| 1849 |
// Gaps iterator should be fused. |
| 1850 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(overlapping.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Overlapping<'a, K, V, R>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1851 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(overlapping.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Overlapping<'a, K, V, R>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1852 |
} |
| 1853 |
|
| 1854 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1855 |
fn overlapping_non_overlapping_edges_complete_middlerust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/overlapping_non_overlapping_edges_complete_middle().() { |
| 1856 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1857 |
|
| 1858 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1859 |
// ●-● ◌ ◌ ◌ ◌ ◌ ◌ ◌ ◌ |
| 1860 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#1, ()); |
| 1861 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1862 |
// ◌ ◌ ◌ ●-● ◌ ◌ ◌ ◌ ◌ |
| 1863 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(3..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#4, ()); |
| 1864 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1865 |
// ◌ ◌ ◌ ◌ ◌ ◌ ●-● ◌ ◌ |
| 1866 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(6..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#7, ()); |
| 1867 |
|
| 1868 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1869 |
// ◌ ◌ ◆-----◆ ◌ ◌ ◌ ◌ |
| 1870 |
let query_range = 2..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5; |
| 1871 |
|
| 1872 |
let mut overlapping = range_map.overlappingrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]overlapping().(&query_range); |
| 1873 |
|
| 1874 |
// Should only yield the completely overlapped range in middle. |
| 1875 |
// (Not the ranges that are touched by not covered to either side.) |
| 1876 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(overlapping.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Overlapping<'a, K, V, R>`][Iterator]next().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&(3..=4), &()))); |
| 1877 |
// Gaps iterator should be fused. |
| 1878 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(overlapping.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Overlapping<'a, K, V, R>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1879 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(overlapping.nextrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`Overlapping<'a, K, V, R>`][Iterator]next().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1880 |
} |
| 1881 |
|
| 1882 |
/// |
| 1883 |
/// impl Debug |
| 1884 |
/// |
| 1885 |
|
| 1886 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1887 |
fn map_debug_repr_looks_rightrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/map_debug_repr_looks_right().() { |
| 1888 |
let mut map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1889 |
|
| 1890 |
// Empty |
| 1891 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:?}", map), "{}"); |
| 1892 |
|
| 1893 |
// One entry |
| 1894 |
map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(2..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5, ()); |
| 1895 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:?}", map), "{2..=5: ()}"); |
| 1896 |
|
| 1897 |
// Many entries |
| 1898 |
map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(7..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#8, ()); |
| 1899 |
map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(10..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#11, ()); |
| 1900 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:?}", map), "{2..=5: (), 7..=8: (), 10..=11: ()}"); |
| 1901 |
} |
| 1902 |
|
| 1903 |
// impl Default where T: ?Default |
| 1904 |
|
| 1905 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1906 |
fn always_defaultrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/always_default().() { |
| 1907 |
struct NoDefaultrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/NoDefault#; |
| 1908 |
RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::<NoDefaultrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/NoDefault#, NoDefaultrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/NoDefault#>::defaultrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`][Default]default().(); |
| 1909 |
} |
| 1910 |
|
| 1911 |
// impl Serialize |
| 1912 |
|
| 1913 |
#[cfg(feature = "serde1")] |
| 1914 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1915 |
fn serializationrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/serialization().() { |
| 1916 |
let mut range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1917 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1918 |
// ◌ ◆---◆ ◌ ◌ ◌ ◌ ◌ ◌ |
| 1919 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#3, false); |
| 1920 |
// 0 1 2 3 4 5 6 7 8 9 |
| 1921 |
// ◌ ◌ ◌ ◌ ◌ ◆---◆ ◌ ◌ |
| 1922 |
range_map.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(5..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#7, true); |
| 1923 |
let output = serde_jsonrust-analyzer cargo serde_json 1.0.143 crate/::to_stringrust-analyzer cargo serde_json 1.0.143 ser/to_string().(&range_map).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("Failed to serialize"); |
| 1924 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(output, "[[[1,3],false],[[5,7],true]]"); |
| 1925 |
} |
| 1926 |
|
| 1927 |
// impl Deserialize |
| 1928 |
|
| 1929 |
#[cfg(feature = "serde1")] |
| 1930 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1931 |
fn deserializationrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/deserialization().() { |
| 1932 |
let input = "[[[1,3],false],[[5,7],true]]"; |
| 1933 |
let range_map: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = |
| 1934 |
serde_jsonrust-analyzer cargo serde_json 1.0.143 crate/::from_strrust-analyzer cargo serde_json 1.0.143 de/from_str().(input).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("Failed to deserialize"); |
| 1935 |
let reserialized = serde_jsonrust-analyzer cargo serde_json 1.0.143 crate/::to_stringrust-analyzer cargo serde_json 1.0.143 ser/to_string().(&range_map).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("Failed to re-serialize"); |
| 1936 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(reserialized, input); |
| 1937 |
} |
| 1938 |
|
| 1939 |
// const fn |
| 1940 |
|
| 1941 |
#[cfg(feature = "const_fn")] |
| 1942 |
const _MAPrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/_MAP.: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1943 |
#[cfg(feature = "const_fn")] |
| 1944 |
const _MAP2rust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/_MAP2.: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, bool> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::new_with_step_fnsrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]new_with_step_fns().(); |
| 1945 |
|
| 1946 |
// Equality |
| 1947 |
|
| 1948 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1949 |
fn test_equality_same_start_different_endrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/test_equality_same_start_different_end().() { |
| 1950 |
let mut a: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1951 |
a.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5, ()); |
| 1952 |
|
| 1953 |
let mut b: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1954 |
b.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#2, ()); |
| 1955 |
|
| 1956 |
assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(a, b); |
| 1957 |
} |
| 1958 |
|
| 1959 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1960 |
fn test_equality_identical_rangesrust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/test_equality_identical_ranges().() { |
| 1961 |
let mut a: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1962 |
a.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5, ()); |
| 1963 |
|
| 1964 |
let mut b: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<u32, ()> = RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#::newrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V>`]new().(); |
| 1965 |
b.insertrust-analyzer cargo rangemap 1.7.1 inclusive_map/impl#[`RangeInclusiveMap<K, V, StepFnsT>`]insert().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5, ()); |
| 1966 |
|
| 1967 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a, b); |
| 1968 |
} |
| 1969 |
|
| 1970 |
#[cfg(feature = "quickcheck")] |
| 1971 |
quickcheckrust-analyzer cargo quickcheck 1.0.3 crate/::quickcheckrust-analyzer cargo quickcheck 1.0.3 quickcheck!! { |
| 1972 |
fn proprust-analyzer cargo rangemap 1.7.1 inclusive_map/tests/prop().(xs: RangeInclusiveMaprust-analyzer cargo rangemap 1.7.1 inclusive_map/RangeInclusiveMap#<usize, usize>) -> bool { |
| 1973 |
xs == xs |
| 1974 |
} |
| 1975 |
} |
| 1976 |
} |