[−][src]Enum infinitable::Infinitable
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]
pub fn is_finite(&self) -> bool
[src]
Returns true
if the value is Finite
.
Examples
use infinitable::Finite; let finite = Finite(5); assert!(finite.is_finite());
pub 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::*; let finite = Finite(5); assert_eq!(Some(5), finite.finite()); let infinite: Infinitable<i32> = Infinity; assert_eq!(None, infinite.finite());
pub fn finite_or_infinity(option: Option<T>) -> Infinitable<T>
[src]
Converts from an Option<T>
to either Finite
or Infinity
.
Converts an Option<T>
to an Infinitable<T>
. Some(T)
is converted
to Finite(T)
, and None
is converted to Infinity
.
Examples
use infinitable::*; let finite = Finite(5); assert_eq!(finite, Infinitable::finite_or_infinity(Some(5))); let infinite: Infinitable<i32> = Infinity; assert_eq!(infinite, Infinitable::finite_or_infinity(None));
pub fn finite_or_negative_infinity(option: Option<T>) -> Infinitable<T>
[src]
Converts from an Option<T>
to either Finite
or NegativeInfinity
.
Converts an Option<T>
to an Infinitable<T>
. Some(T)
is converted
to Finite(T)
, and None
is converted to NegativeInfinity
.
Examples
use infinitable::*; let finite = Finite(5); assert_eq!(finite, Infinitable::finite_or_negative_infinity(Some(5))); let infinite: Infinitable<i32> = NegativeInfinity; assert_eq!(infinite, Infinitable::finite_or_negative_infinity(None));
Trait Implementations
impl<T: Clone> Clone for Infinitable<T>
[src]
fn clone(&self) -> Infinitable<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Copy> Copy for Infinitable<T>
[src]
impl<T: Debug> Debug for Infinitable<T>
[src]
impl<T> Display for Infinitable<T> where
T: Display,
[src]
T: Display,
impl<T: Eq> Eq for Infinitable<T>
[src]
impl<T> From<T> for Infinitable<T>
[src]
fn from(value: T) -> Infinitable<T>
[src]
impl<T: Hash> Hash for Infinitable<T>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
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]
impl<T> Ord for Infinitable<T> where
T: Ord,
[src]
T: Ord,
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: PartialEq> PartialEq<Infinitable<T>> for Infinitable<T>
[src]
fn eq(&self, other: &Infinitable<T>) -> bool
[src]
fn ne(&self, other: &Infinitable<T>) -> bool
[src]
impl<T> PartialOrd<Infinitable<T>> for Infinitable<T> where
T: PartialOrd,
[src]
T: PartialOrd,
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T> StructuralEq for Infinitable<T>
[src]
impl<T> StructuralPartialEq for Infinitable<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Infinitable<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Infinitable<T> where
T: Send,
T: Send,
impl<T> Sync for Infinitable<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Infinitable<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Infinitable<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<!> for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,