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]
Converts 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: Copy> Copy for Infinitable<T>
[src]
impl<T: Clone> Clone for Infinitable<T>
[src]
fn clone(&self) -> Infinitable<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T> From<T> for Infinitable<T>
[src]
fn from(value: T) -> Infinitable<T>
[src]
Performs the conversion.
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
impl<T> Neg for Infinitable<T> where
T: Neg,
[src]
T: Neg,
type Output = Infinitable<T::Output>
The resulting type after applying the -
operator.
fn neg(self) -> Infinitable<T::Output>
[src]
Performs the unary -
operation.
impl<T> Display for Infinitable<T> where
T: Display,
[src]
T: Display,