[][src]Struct math_interval::Interval

pub struct Interval<T: PartialOrd> { /* fields omitted */ }

An Interval struct represents an interval. The main appeal is that it allows checking if a number is between the interval bounds more easily than manually writing the inequality comparisons yourself.

Methods

impl<T: PartialOrd> Interval<T>[src]

pub fn new(bound1: T, bound2: T) -> Interval<T>[src]

The new function enables construction of an Interval without needing to think about which boundary is greater.

pub fn contains(&self, value: T) -> bool[src]

The contains function enables easy checking if a value is contained in the open version of an interval (the bounds are not not part of the interval).

pub fn contains_closed(&self, value: T) -> bool[src]

The contains_closed enables easy cheching if a value is contained in the contained in the closed version of an interval (the bounds are part of the interval).

Auto Trait Implementations

impl<T> Send for Interval<T> where
    T: Send

impl<T> Sync for Interval<T> where
    T: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]