Enum infinitable::Infinitable [] [src]

pub enum Infinitable<T> {
    Finite(T),
    Infinity,
    NegativeInfinity,
}

An "infinitable" value, one that can be either finite or infinite

Variants

A finite value T

Positive infinity, which compares greater than all finite values

Negative infinity, which compares less than all finite values

Methods

impl<T> Infinitable<T>
[src]

[src]

Returns true if the value is Finite.

Examples

use infinitable::Infinitable;

let finite = Infinitable::Finite(5);
assert!(finite.is_finite());

[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]

[src]

Formats the value using the given formatter.

impl<T> PartialEq for Infinitable<T> where
    T: PartialEq
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl<T> Eq for Infinitable<T> where
    T: Eq
[src]

impl<T> PartialOrd for Infinitable<T> where
    T: PartialOrd
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

1.0.0
[src]

This method tests less than (for self and other) and is used by the < operator. Read more

1.0.0
[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

1.0.0
[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

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]

[src]

This method returns an Ordering between self and other. Read more

1.22.0
[src]

Compares and returns the maximum of two values. Read more

1.22.0
[src]

Compares and returns the minimum of two values. Read more