fix doc tests
This commit is contained in:
@@ -7,6 +7,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
either = "1.8.0"
|
||||
ordered-float = "3.4.0"
|
||||
|
||||
[dev-dependencies]
|
||||
ordered-float = "3.4.0"
|
||||
|
||||
+2
-2
@@ -43,13 +43,13 @@ pub(crate) enum StartBound<T> {
|
||||
/// [`BTreeMap::range`] searches in [`crate::RangeBoundsMap::overlapping()`]
|
||||
///
|
||||
/// [`end_bound()`]: https://doc.rust-lang.org/std/ops/trait.RangeBounds.html#tymethod.end_bound
|
||||
/// [`BTreeMap::range`]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.range
|
||||
/// [`BTreeMap::range`]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.range
|
||||
ReverseExcluded(T),
|
||||
/// Workaround type used to represent [`Bound::Unbounded`] in [`end_bound()`] in meta-bound
|
||||
/// [`BTreeMap::range`] searches in [`crate::RangeBoundsMap::overlapping()`]
|
||||
///
|
||||
/// [`end_bound()`]: https://doc.rust-lang.org/std/ops/trait.RangeBounds.html#tymethod.end_bound
|
||||
/// [`BTreeMap::range`]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.range
|
||||
/// [`BTreeMap::range`]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.range
|
||||
ReverseUnbounded,
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ where
|
||||
where
|
||||
Q: RangeBounds<I>,
|
||||
{
|
||||
//todo panic on invalid search range
|
||||
//todo panic on invalid search range
|
||||
|
||||
//optimisation fix this without cloning
|
||||
let start =
|
||||
@@ -130,8 +130,9 @@ where
|
||||
}
|
||||
|
||||
pub fn get_at_point_mut(&mut self, point: &I) -> Option<&mut V> {
|
||||
if let Some(overlapping_start_bound) =
|
||||
self.get_key_value_at_point(point).map(|(key, _)| key.start_bound())
|
||||
if let Some(overlapping_start_bound) = self
|
||||
.get_key_value_at_point(point)
|
||||
.map(|(key, _)| key.start_bound())
|
||||
{
|
||||
return self
|
||||
.starts
|
||||
@@ -152,7 +153,6 @@ where
|
||||
.next();
|
||||
}
|
||||
|
||||
|
||||
pub fn iter(&self) -> impl Iterator<Item = (&K, &V)> {
|
||||
self.starts.iter().map(|(_, (key, value))| (key, value))
|
||||
}
|
||||
|
||||
@@ -72,18 +72,15 @@ use crate::range_bounds_map::RangeBoundsMap;
|
||||
/// Bound::Excluded(&self.start)
|
||||
/// }
|
||||
/// fn end_bound(&self) -> Bound<&NotNan<f32>> {
|
||||
/// Bound::Excluded(&self.start)
|
||||
/// Bound::Excluded(&self.end)
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// // Now we can make a [`RangeBoundsSet`] of [`ExEx``]s
|
||||
/// // Now we can make a [`RangeBoundsSet`] of [`ExEx`]s
|
||||
/// let mut set = RangeBoundsSet::new();
|
||||
///
|
||||
/// set.insert(ExEx::new(0.0, 5.0));
|
||||
/// set.insert(ExEx::new(5.0, 7.5));
|
||||
///
|
||||
/// assert!(NotNan::new(5.0).unwrap() < NotNan::new(5.0).unwrap());
|
||||
/// panic!();
|
||||
/// set.insert(ExEx::new(0.0, 5.0)).unwrap();
|
||||
/// set.insert(ExEx::new(5.0, 7.5)).unwrap();
|
||||
///
|
||||
/// assert_eq!(set.contains_point(&(NotNan::new(5.0).unwrap())), false);
|
||||
/// assert_eq!(set.contains_point(&(NotNan::new(7.0).unwrap())), true);
|
||||
|
||||
Reference in New Issue
Block a user