Trait macro_tools::protected::NonIterableInterval

source ·
pub trait NonIterableInterval<T = isize>
where T: EndPointTrait<T>, isize: Into<T>,
{ // Required methods fn left(&self) -> Bound<T>; fn right(&self) -> Bound<T>; // Provided methods fn bounds(&self) -> (Bound<T>, Bound<T>) { ... } fn closed_left(&self) -> T { ... } fn closed_right(&self) -> T { ... } fn closed_len(&self) -> T { ... } fn closed(&self) -> (T, T) { ... } fn canonical(&self) -> Interval<T> { ... } }
Expand description

Interval adapter. Interface to interval-like structures.

NonIterableInterval it does not implement iterator unlike IterableInterval. IterableInterval inherits all methods of NonIterableInterval.

Non-iterable intervals have either one or several unbound endpoints. For example, interval core::ops::RangeFull has no bounds and represents the range from minus infinity to plus infinity.

Required Methods§

source

fn left(&self) -> Bound<T>

The left endpoint of the interval, as is.

source

fn right(&self) -> Bound<T>

The right endpoint of the interval, as is.

Provided Methods§

source

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

Interval in closed format as pair of numbers. To convert open endpoint to closed add or subtract one.

source

fn closed_left(&self) -> T

The left endpoint of the interval, converting interval into closed one.

source

fn closed_right(&self) -> T

The right endpoint of the interval, converting interval into closed one.

source

fn closed_len(&self) -> T

Length of the interval, converting interval into closed one.

source

fn closed(&self) -> (T, T)

Interval in closed format as pair of numbers, converting interval into closed one.

source

fn canonical(&self) -> Interval<T>

Convert to interval in canonical format.

Implementations on Foreign Types§

source§

impl<T> NonIterableInterval<T> for (Bound<T>, Bound<T>)
where T: EndPointTrait<T>, isize: Into<T>,

source§

fn left(&self) -> Bound<T>

source§

fn right(&self) -> Bound<T>

source§

impl<T> NonIterableInterval<T> for [T; 2]
where T: EndPointTrait<T>, isize: Into<T>,

source§

fn left(&self) -> Bound<T>

source§

fn right(&self) -> Bound<T>

source§

impl<T> NonIterableInterval<T> for (T, T)
where T: EndPointTrait<T>, isize: Into<T>,

source§

fn left(&self) -> Bound<T>

source§

fn right(&self) -> Bound<T>

source§

impl<T> NonIterableInterval<T> for Range<T>
where T: EndPointTrait<T>, isize: Into<T>,

source§

fn left(&self) -> Bound<T>

source§

fn right(&self) -> Bound<T>

source§

impl<T> NonIterableInterval<T> for RangeFrom<T>
where T: EndPointTrait<T>, isize: Into<T>,

source§

fn left(&self) -> Bound<T>

source§

fn right(&self) -> Bound<T>

source§

impl<T> NonIterableInterval<T> for RangeFull
where T: EndPointTrait<T>, isize: Into<T>,

source§

fn left(&self) -> Bound<T>

source§

fn right(&self) -> Bound<T>

source§

impl<T> NonIterableInterval<T> for RangeInclusive<T>
where T: EndPointTrait<T>, isize: Into<T>,

source§

fn left(&self) -> Bound<T>

source§

fn right(&self) -> Bound<T>

source§

impl<T> NonIterableInterval<T> for RangeTo<T>
where T: EndPointTrait<T>, isize: Into<T>,

source§

fn left(&self) -> Bound<T>

source§

fn right(&self) -> Bound<T>

source§

impl<T> NonIterableInterval<T> for RangeToInclusive<T>
where T: EndPointTrait<T>, isize: Into<T>,

source§

fn left(&self) -> Bound<T>

source§

fn right(&self) -> Bound<T>

source§

impl<T> NonIterableInterval<T> for [Bound<T>; 2]
where T: EndPointTrait<T>, isize: Into<T>,

source§

fn left(&self) -> Bound<T>

source§

fn right(&self) -> Bound<T>

Implementors§

source§

impl<T> NonIterableInterval<T> for Interval<T>
where T: EndPointTrait<T>, isize: Into<T>,