Enum infinitable::Infinitable
[−]
[src]
pub enum Infinitable<T> { Finite(T), Infinity, NegativeInfinity, }
An "infinitable" value, one that can be either finite or infinite
Variants
Finite(T)
A finite value T
Infinity
Positive infinity, which compares greater than all finite values
NegativeInfinity
Negative infinity, which compares less than all finite values
Methods
impl<T> Infinitable<T>
[src]
fn is_finite(&self) -> bool
[src]
Returns true
if the value is Finite
.
Examples
use infinitable::Infinitable; let finite = Infinitable::Finite(5); assert!(finite.is_finite());
fn finite(self) -> Option<T>
[src]
Convert from an Infinitable<T>
to an Option<T>
.
Converts self
into an Option<T>
possibly containing a finite value,
consuming self
.
Examples
use infinitable::Infinitable; let finite = Infinitable::Finite(5); assert_eq!(Some(5), finite.finite()); let infinite: Infinitable<i32> = Infinitable::Infinity; assert_eq!(None, infinite.finite());
Trait Implementations
impl<T: Debug> Debug for Infinitable<T>
[src]
impl<T> PartialEq for Infinitable<T> where
T: PartialEq,
[src]
T: PartialEq,
fn eq(&self, other: &Self) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<T> Eq for Infinitable<T> where
T: Eq,
[src]
T: Eq,
impl<T> PartialOrd for Infinitable<T> where
T: PartialOrd,
[src]
T: PartialOrd,
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T> Ord for Infinitable<T> where
T: Ord,
[src]
T: Ord,
fn cmp(&self, other: &Self) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.22.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.22.0[src]
Compares and returns the minimum of two values. Read more