pub trait IntervalAdapter<T = isize>where
    T: Sub<Output = T> + Add<Output = T> + Copy,
    isize: Into<T>,{
    // Required methods
    fn first(&self) -> T;
    fn last(&self) -> T;

    // Provided methods
    fn len(&self) -> T { ... }
    fn closed(&self) -> (T, T) { ... }
    fn closed_open(&self) -> (T, T) { ... }
    fn first_len(&self) -> (T, T) { ... }
}
Expand description

Interval adapter. Interface to interval-like structures.

Required Methods§

source

fn first(&self) -> T

the first element of the ( closed ) interval

source

fn last(&self) -> T

the last element of the ( closed ) interval

Provided Methods§

source

fn len(&self) -> T

number of discrete elements in the interval

source

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

interval in closed format as pair of numbers

source

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

interval in closed-open format as pair of numbers

source

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

interval in first-length format as pair of numbers

Implementations on Foreign Types§

source§

impl<T> IntervalAdapter<T> for Range<T>where T: Add<Output = T> + Sub<Output = T> + Copy, isize: Into<T>,

source§

fn first(&self) -> T

source§

fn last(&self) -> T

source§

impl<T> IntervalAdapter<T> for RangeInclusive<T>where T: Add<Output = T> + Sub<Output = T> + Copy, isize: Into<T>,

source§

fn first(&self) -> T

source§

fn last(&self) -> T

Implementors§

source§

impl<T> IntervalAdapter<T> for Interval<T>where T: Add<Output = T> + Sub<Output = T> + Copy, isize: Into<T>,