checkpoint

This commit is contained in:
ripytide 2023-04-19 14:41:06 +01:00
parent 2cb87db1eb
commit d1a15f51fa
No known key found for this signature in database
GPG Key ID: B2629F9EC7C2FE8C
3 changed files with 14 additions and 21 deletions

10
Cargo.lock generated
View File

@ -46,15 +46,6 @@ version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
[[package]]
name = "itertools"
version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
dependencies = [
"either",
]
[[package]]
name = "num-traits"
version = "0.2.15"
@ -118,7 +109,6 @@ version = "0.3.1"
dependencies = [
"btree_monstrousity",
"either",
"itertools",
"ordered-float",
"pretty_assertions",
"serde",

View File

@ -17,7 +17,6 @@ categories = ["data-structures"]
[dependencies]
serde = {version = "1.0.148", features = ["derive"]}
itertools = "0.10.5"
btree_monstrousity = {version ="0.0.4", features = ["btree_drain_filter", "btree_cursors"]}
either = "1.8.1"

View File

@ -28,7 +28,6 @@ use btree_monstrousity::btree_map::{
};
use btree_monstrousity::BTreeMap;
use either::Either;
use itertools::Itertools;
use serde::de::{MapAccess, Visitor};
use serde::ser::SerializeMap;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
@ -942,12 +941,12 @@ where
/// ]
/// );
/// ```
pub fn gaps<'a, Q>(
&'a self,
pub fn gaps<Q>(
&self,
outer_range: Q,
) -> impl Iterator<Item = (Bound<I>, Bound<I>)> + '_
) -> impl DoubleEndedIterator<Item = (Bound<I>, Bound<I>)>
where
Q: NiceRange<I> + 'a,
Q: NiceRange<I>,
{
invalid_range_panic(outer_range);
@ -989,11 +988,16 @@ where
}
return artificials
.tuple_windows()
.map(|((_, first_end), (second_start, _))| {
(flip_bound(first_end), flip_bound(second_start))
})
.filter(|range| is_valid_range(*range));
//optimisation find an implementation of windows()
//somewhere that supports DoubleEndedIterator, I couldn't
//find one at the time of writing
.collect::<Vec<_>>()
.windows(2)
.map(|windows| (flip_bound(windows[0].1), flip_bound(windows[1].0)))
.filter(|range| is_valid_range(*range))
//optimisation this would also then be unneccessary
.collect::<Vec<_>>()
.into_iter();
}
/// Returns `true` if the map covers every point in the given