Trait IntervalAdapter

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