Trait NormalizedRangeIter

Source
pub trait NormalizedRangeIter:
    Sealed
    + Sized
    + Iterator<Item: ClosedRange> {
    // Provided methods
    fn eqv(
        self,
        other: impl IntoNormalizedRangeIter<IntoIter: Iterator<Item: ClosedRange<EndT = <Self::Item as ClosedRange>::EndT>>>,
    ) -> bool { ... }
    fn complement(self) -> ComplementIterator<Self> { ... }
    fn intersect_vec<'a>(
        self,
        other: &'a RangeVec<<Self::Item as ClosedRange>::EndT>,
    ) -> impl 'a + NormalizedRangeIter<Item = (<Self::Item as ClosedRange>::EndT, <Self::Item as ClosedRange>::EndT)>
       where Self: 'a { ... }
    fn intersect<Other>(
        self,
        other: Other,
    ) -> LinearIntersectionIterator<<Self::Item as ClosedRange>::EndT, Self, <Other as IntoIterator>::IntoIter>
       where Other: IntoNormalizedRangeIter<IntoIter: NormalizedRangeIter<Item: ClosedRange<EndT = <Self::Item as ClosedRange>::EndT>>> { ... }
    fn union<Other>(
        self,
        other: Other,
    ) -> UnionIterator<<Self::Item as ClosedRange>::EndT, Self, <Other as IntoIterator>::IntoIter>
       where Other: IntoNormalizedRangeIter<IntoIter: NormalizedRangeIter<Item: ClosedRange<EndT = <Self::Item as ClosedRange>::EndT>>> { ... }
    fn collect_range_vec(self) -> RangeVec<<Self::Item as ClosedRange>::EndT> { ... }
}
Expand description

A NormalizedRangeIter yields a sorted sequence of non-overlapping, non-adjacent, non-empty closed ranges.

It’s hard to check for this property at runtime, so this trait is sealed.

Provided Methods§

Source

fn eqv( self, other: impl IntoNormalizedRangeIter<IntoIter: Iterator<Item: ClosedRange<EndT = <Self::Item as ClosedRange>::EndT>>>, ) -> bool

Determines whether this range iterator is equivalent to (represents the same set of values as) another.

This operation takes constant space and time linear in the shorter length of the two input iterators.

Source

fn complement(self) -> ComplementIterator<Self>

Returns an iterator for the complement of this normalized range iterator.

Running the resulting iterator to exhaustion takes constant space and time linear in the length of the input iterator.

The result is also a NormalizedRangeIter.

Source

fn intersect_vec<'a>( self, other: &'a RangeVec<<Self::Item as ClosedRange>::EndT>, ) -> impl 'a + NormalizedRangeIter<Item = (<Self::Item as ClosedRange>::EndT, <Self::Item as ClosedRange>::EndT)>
where Self: 'a,

Returns an iterator for the intersection of this normalized range iterator and another RangeVec of normalized ranges.

Running the resulting iterator to exhaustion takes constant space and \(\mathcal{O}(\min(m + n, m \log n))\) time, where \(m\) is the size of self, and \(n\) that of other.

The result is also a NormalizedRangeIter.

Source

fn intersect<Other>( self, other: Other, ) -> LinearIntersectionIterator<<Self::Item as ClosedRange>::EndT, Self, <Other as IntoIterator>::IntoIter>
where Other: IntoNormalizedRangeIter<IntoIter: NormalizedRangeIter<Item: ClosedRange<EndT = <Self::Item as ClosedRange>::EndT>>>,

Returns an iterator for the intersection of this normalized range iterator and another iterator of normalized ranges.

Running the resulting iterator to exhaustion takes constant space and time linear in the total length of the two input iterators.

The result is also a NormalizedRangeIter.

Source

fn union<Other>( self, other: Other, ) -> UnionIterator<<Self::Item as ClosedRange>::EndT, Self, <Other as IntoIterator>::IntoIter>
where Other: IntoNormalizedRangeIter<IntoIter: NormalizedRangeIter<Item: ClosedRange<EndT = <Self::Item as ClosedRange>::EndT>>>,

Returns an interator for the union of this normalized range iterator and another normalized range iterator.

Running the resulting iterator to exhaustion takes constant space and time linear in the total length of the two input iterators.

The result is also a NormalizedRangeIter.

Source

fn collect_range_vec(self) -> RangeVec<<Self::Item as ClosedRange>::EndT>

Collects the contents of a NormalizedRangeIter into a RangeVec.

This takes time linear in the length of the input iterator (in addition to the resources used by the iterator itself).

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.

Implementors§