[−][src]Struct math_interval::Interval
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 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
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,