rustmax::nom

Trait NomRange

Source
pub trait NomRange<Idx> {
    type Saturating: Iterator<Item = Idx>;
    type Bounded: Iterator<Item = Idx>;

    // Required methods
    fn contains(&self, item: &Idx) -> bool;
    fn bounds(&self) -> (Bound<Idx>, Bound<Idx>);
    fn is_inverted(&self) -> bool;
    fn saturating_iter(&self) -> Self::Saturating;
    fn bounded_iter(&self) -> Self::Bounded;
}
Expand description

Abstractions for range-like types.

Required Associated Types§

Source

type Saturating: Iterator<Item = Idx>

The saturating iterator type.

Source

type Bounded: Iterator<Item = Idx>

The bounded iterator type.

Required Methods§

Source

fn contains(&self, item: &Idx) -> bool

true if item is contained in the range.

Source

fn bounds(&self) -> (Bound<Idx>, Bound<Idx>)

Returns the bounds of this range.

Source

fn is_inverted(&self) -> bool

true if the range is inverted.

Source

fn saturating_iter(&self) -> Self::Saturating

Creates a saturating iterator. A saturating iterator counts the number of iterations starting from 0 up to the upper bound of this range. If the upper bound is infinite the iterator saturates at the largest representable value of its type and returns it for all further elements.

Source

fn bounded_iter(&self) -> Self::Bounded

Creates a bounded iterator. A bounded iterator counts the number of iterations starting from 0 up to the upper bound of this range. If the upper bounds is infinite the iterator counts up until the amount of iterations has reached the largest representable value of its type and then returns None for all further elements.

Implementations on Foreign Types§

Source§

impl NomRange<usize> for usize

Implementors§