Trait IntervalIterator

Source
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§

Source

type IntervalIter: Iterator<Item = RangeInclusive<E>>

The type of the interval iterator.

Required Methods§

Source

fn intervals(&self) -> Self::IntervalIter

Returns an iterator over the ordered intervals.

Provided Methods§

Source

fn card(&self) -> usize

Returns the number of elements contained within the RangeList.

Source

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.

Source

fn disjoint<O: IntervalIterator<E> + ?Sized>(&self, other: &O) -> bool

Returns whether self and other are disjoint sets

Source

fn intersect<O, R>(&self, other: &O) -> R

Return the set intersection of two interval iterators.

Source

fn subset<O: IntervalIterator<E> + ?Sized>(&self, other: &O) -> bool

Returns whether self is a subset of other

Source

fn superset<O: IntervalIterator<E> + ?Sized>(&self, other: &O) -> bool

Returns whether self is a superset of other

Source

fn union<O, R>(&self, other: &O) -> R

Return the set union of two interval iterators.

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.

Implementations on Foreign Types§

Source§

impl<E: Clone + Ord> IntervalIterator<E> for BTreeSet<E>

Source§

impl<E: Clone + Ord> IntervalIterator<E> for HashSet<E>

Implementors§