Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/merge_state.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::needless_lifetimes)]
use crate::iterators::SliceIterator;
use binary_merge::{MergeOperation, MergeState};
use core::fmt::Debug;
Expand Down
14 changes: 12 additions & 2 deletions src/range_set.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![deny(missing_docs)]
#![allow(clippy::needless_lifetimes)]

//! A set of non-overlapping ranges
use crate::merge_state::{
Expand Down Expand Up @@ -92,6 +93,12 @@ use {
/// Testing is done by some simple smoke tests as well as quickcheck tests of the algebraic properties of the boolean operations.
pub struct RangeSet<A: Array>(SmallVec<A>);

impl<T, A: Array<Item = T>> Default for RangeSet<A> {
fn default() -> Self {
Self(Default::default())
}
}

impl<T, A: Array<Item = T>> Deref for RangeSet<A> {
type Target = RangeSetRef<T>;

Expand Down Expand Up @@ -249,7 +256,10 @@ impl<T> RangeSetRef<T> {
RangeSetRef::new_unchecked_impl(&[])
}

/// Create a new range set reference for a single value
/// Create a new range set reference for a single boundary change
///
/// This produces a RangeSetRef that goes from off before `value` to on at
/// *and after* `value`.
pub const fn single(value: &T) -> &Self {
RangeSetRef::new_unchecked_impl(std::slice::from_ref(value))
}
Expand Down Expand Up @@ -851,7 +861,7 @@ impl<T: Ord, A: Array<Item = T>> SubAssign for RangeSet<A> {
impl<T: RangeSetEntry + Clone, A: Array<Item = T>> Not for RangeSet<A> {
type Output = RangeSet<A>;
fn not(mut self) -> Self::Output {
match self.0.get(0) {
match self.0.first() {
Some(x) if x.is_min_value() => {
self.0.remove(0);
}
Expand Down