added get_at_point back to set.rs and added Eq derives

This commit is contained in:
ripytide 2023-04-09 19:25:05 +01:00
parent f0cbe5dc7c
commit 6eb6d8dd2b
No known key found for this signature in database
GPG Key ID: B2629F9EC7C2FE8C
3 changed files with 7 additions and 3 deletions

2
Cargo.lock generated
View File

@ -114,7 +114,7 @@ dependencies = [
[[package]]
name = "range_bounds_map"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"btree_monstrousity",
"either",

View File

@ -135,7 +135,7 @@ use crate::TryFromBounds;
///
/// [`RangeBounds`]: https://doc.rust-lang.org/std/ops/trait.RangeBounds.html
/// [`BTreeMap`]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct RangeBoundsMap<I, K, V> {
inner: BTreeMap<K, V>,
phantom: PhantomData<I>,

View File

@ -25,7 +25,7 @@ use crate::{
/// See [`RangeBoundsMap`] for more details.
///
/// [`RangeBounds`]: https://doc.rust-lang.org/std/ops/trait.RangeBounds.html
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct RangeBoundsSet<I, K> {
inner: RangeBoundsMap<I, K, ()>,
}
@ -66,6 +66,10 @@ where
{
self.inner.overlapping(range).map(first)
}
/// See [`RangeBoundsMap::get_at_point()`] for more details.
pub fn get_at_point(&self, point: I) -> Option<K> {
self.inner.get_entry_at_point(point).map(first).copied()
}
/// See [`RangeBoundsMap::contains_point()`] for more details.
pub fn contains_point(&self, point: I) -> bool {
self.inner.contains_point(point)