pub trait IntervalIterator<E: PartialOrd> {
type IntervalIter: Iterator<Item = RangeInclusive<E>>;
// Required method
fn intervals(&self) -> Self::IntervalIter;
// Provided methods
fn card(&self) -> usize
where E: AsPrimitive<usize> + Integer { ... }
fn diff<O, R>(&self, other: &O) -> R
where E: Clone + Integer,
O: IntervalIterator<E>,
R: FromIterator<RangeInclusive<E>> { ... }
fn disjoint<O: IntervalIterator<E> + ?Sized>(&self, other: &O) -> bool { ... }
fn intersect<O, R>(&self, other: &O) -> R
where E: Clone,
O: IntervalIterator<E>,
R: FromIterator<RangeInclusive<E>> { ... }
fn subset<O: IntervalIterator<E> + ?Sized>(&self, other: &O) -> bool { ... }
fn superset<O: IntervalIterator<E> + ?Sized>(&self, other: &O) -> bool { ... }
fn union<O, R>(&self, other: &O) -> R
where E: Clone,
O: IntervalIterator<E>,
R: FromIterator<RangeInclusive<E>> { ... }
}
Expand description
A trait that provides operations on iterators of orderdered intervals.
Required Associated Types§
Sourcetype IntervalIter: Iterator<Item = RangeInclusive<E>>
type IntervalIter: Iterator<Item = RangeInclusive<E>>
The type of the interval iterator.
Required Methods§
Sourcefn intervals(&self) -> Self::IntervalIter
fn intervals(&self) -> Self::IntervalIter
Returns an iterator over the ordered intervals.
Provided Methods§
Sourcefn diff<O, R>(&self, other: &O) -> R
fn diff<O, R>(&self, other: &O) -> R
Compute RangeList without any of the elements in the ranges of other
.
§Warning
The implementation decrements the lowest value of self
and increments
the largest value of self
. This could cause a panic if this causes
overflow in E
.
Sourcefn disjoint<O: IntervalIterator<E> + ?Sized>(&self, other: &O) -> bool
fn disjoint<O: IntervalIterator<E> + ?Sized>(&self, other: &O) -> bool
Returns whether self
and other
are disjoint sets
Sourcefn intersect<O, R>(&self, other: &O) -> R
fn intersect<O, R>(&self, other: &O) -> R
Return the set intersection of two interval iterators.
Sourcefn subset<O: IntervalIterator<E> + ?Sized>(&self, other: &O) -> bool
fn subset<O: IntervalIterator<E> + ?Sized>(&self, other: &O) -> bool
Returns whether self
is a subset of other
Sourcefn superset<O: IntervalIterator<E> + ?Sized>(&self, other: &O) -> bool
fn superset<O: IntervalIterator<E> + ?Sized>(&self, other: &O) -> bool
Returns whether self
is a superset of other
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.