Struct ordered_float::NotNan[][src]

#[repr(transparent)]
pub struct NotNan<T>(_);
Expand description

A wrapper around floats providing an implementation of Eq, Ord and Hash.

A NaN value cannot be stored in this type.

use ordered_float::NotNan;

let mut v = [
    NotNan::new(2.0).unwrap(),
    NotNan::new(1.0).unwrap(),
];
v.sort();
assert_eq!(v, [1.0, 2.0]);

Because NotNan implements Ord and Eq, it can be used as a key in a HashSet, HashMap, BTreeMap, or BTreeSet (unlike the primitive f32 or f64 types):


let mut s: HashSet<NotNan<f32>> = HashSet::new();
let key = NotNan::new(1.0).unwrap();
s.insert(key);
assert!(s.contains(&key));

Arithmetic on NotNan values will panic if it produces a NaN value:

let a = NotNan::new(std::f32::INFINITY).unwrap();
let b = NotNan::new(std::f32::NEG_INFINITY).unwrap();

// This will panic:
let c = a + b;

Implementations

impl<T: Float> NotNan<T>[src]

pub fn new(val: T) -> Result<Self, FloatIsNan>[src]

Create a NotNan value.

Returns Err if val is NaN

impl<T> NotNan<T>[src]

pub fn into_inner(self) -> T[src]

Get the value out.

pub const unsafe fn new_unchecked(val: T) -> Self[src]

Create a NotNan value from a value that is guaranteed to not be NaN

Safety

Behaviour is undefined if val is NaN

pub const unsafe fn unchecked_new(val: T) -> Self[src]

👎 Deprecated since 2.5.0:

Please use the new_unchecked function instead.

Create a NotNan value from a value that is guaranteed to not be NaN

Safety

Behaviour is undefined if val is NaN

Trait Implementations

impl<T: Float> Add<&'_ NotNan<T>> for NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the + operator.

fn add(self, other: &Self) -> Self::Output[src]

Performs the + operation. Read more

impl<T: Float> Add<&'_ NotNan<T>> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the + operator.

fn add(self, other: Self) -> Self::Output[src]

Performs the + operation. Read more

impl<T: Float> Add<&'_ T> for NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the + operator.

fn add(self, other: &T) -> Self::Output[src]

Performs the + operation. Read more

impl<T: Float> Add<&'_ T> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the + operator.

fn add(self, other: &T) -> Self::Output[src]

Performs the + operation. Read more

impl<T: Float> Add<NotNan<T>> for NotNan<T>[src]

type Output = Self

The resulting type after applying the + operator.

fn add(self, other: Self) -> Self[src]

Performs the + operation. Read more

impl<T: Float> Add<NotNan<T>> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the + operator.

fn add(self, other: NotNan<T>) -> Self::Output[src]

Performs the + operation. Read more

impl<T: Float> Add<T> for NotNan<T>[src]

Adds a float directly.

Panics if the provided value is NaN or the computation results in NaN

type Output = Self

The resulting type after applying the + operator.

fn add(self, other: T) -> Self[src]

Performs the + operation. Read more

impl<T: Float> Add<T> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the + operator.

fn add(self, other: T) -> Self::Output[src]

Performs the + operation. Read more

impl<T: Float + AddAssign> AddAssign<&'_ NotNan<T>> for NotNan<T>[src]

fn add_assign(&mut self, other: &Self)[src]

Performs the += operation. Read more

impl<T: Float + AddAssign> AddAssign<&'_ T> for NotNan<T>[src]

fn add_assign(&mut self, other: &T)[src]

Performs the += operation. Read more

impl<T: Float + AddAssign> AddAssign<NotNan<T>> for NotNan<T>[src]

fn add_assign(&mut self, other: Self)[src]

Performs the += operation. Read more

impl<T: Float + AddAssign> AddAssign<T> for NotNan<T>[src]

fn add_assign(&mut self, other: T)[src]

Performs the += operation. Read more

impl<T: Float> AsRef<T> for NotNan<T>[src]

fn as_ref(&self) -> &T[src]

Performs the conversion.

impl<T: Float> Bounded for NotNan<T>[src]

fn min_value() -> Self[src]

returns the smallest finite number this type can represent

fn max_value() -> Self[src]

returns the largest finite number this type can represent

impl<T: Clone> Clone for NotNan<T>[src]

fn clone(&self) -> NotNan<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: Debug> Debug for NotNan<T>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<T: Default> Default for NotNan<T>[src]

fn default() -> NotNan<T>[src]

Returns the “default value” for a type. Read more

impl<T: Float> Deref for NotNan<T>[src]

type Target = T

The resulting type after dereferencing.

fn deref(&self) -> &Self::Target[src]

Dereferences the value.

impl<T: Float + Display> Display for NotNan<T>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<T: Float> Div<&'_ NotNan<T>> for NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the / operator.

fn div(self, other: &Self) -> Self::Output[src]

Performs the / operation. Read more

impl<T: Float> Div<&'_ NotNan<T>> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the / operator.

fn div(self, other: Self) -> Self::Output[src]

Performs the / operation. Read more

impl<T: Float> Div<&'_ T> for NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the / operator.

fn div(self, other: &T) -> Self::Output[src]

Performs the / operation. Read more

impl<T: Float> Div<&'_ T> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the / operator.

fn div(self, other: &T) -> Self::Output[src]

Performs the / operation. Read more

impl<T: Float> Div<NotNan<T>> for NotNan<T>[src]

type Output = Self

The resulting type after applying the / operator.

fn div(self, other: Self) -> Self[src]

Performs the / operation. Read more

impl<T: Float> Div<NotNan<T>> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the / operator.

fn div(self, other: NotNan<T>) -> Self::Output[src]

Performs the / operation. Read more

impl<T: Float> Div<T> for NotNan<T>[src]

Divides a float directly.

Panics if the provided value is NaN or the computation results in NaN

type Output = Self

The resulting type after applying the / operator.

fn div(self, other: T) -> Self[src]

Performs the / operation. Read more

impl<T: Float> Div<T> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the / operator.

fn div(self, other: T) -> Self::Output[src]

Performs the / operation. Read more

impl<T: Float + DivAssign> DivAssign<&'_ NotNan<T>> for NotNan<T>[src]

fn div_assign(&mut self, other: &Self)[src]

Performs the /= operation. Read more

impl<T: Float + DivAssign> DivAssign<&'_ T> for NotNan<T>[src]

fn div_assign(&mut self, other: &T)[src]

Performs the /= operation. Read more

impl<T: Float + DivAssign> DivAssign<NotNan<T>> for NotNan<T>[src]

fn div_assign(&mut self, other: Self)[src]

Performs the /= operation. Read more

impl<T: Float + DivAssign> DivAssign<T> for NotNan<T>[src]

fn div_assign(&mut self, other: T)[src]

Performs the /= operation. Read more

impl From<NotNan<f32>> for NotNan<f64>[src]

fn from(v: NotNan<f32>) -> NotNan<f64>[src]

Performs the conversion.

impl<T: Float + FromPrimitive> FromPrimitive for NotNan<T>[src]

fn from_i64(n: i64) -> Option<Self>[src]

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

fn from_u64(n: u64) -> Option<Self>[src]

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

fn from_isize(n: isize) -> Option<Self>[src]

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

fn from_i8(n: i8) -> Option<Self>[src]

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

fn from_i16(n: i16) -> Option<Self>[src]

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

fn from_i32(n: i32) -> Option<Self>[src]

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

fn from_usize(n: usize) -> Option<Self>[src]

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

fn from_u8(n: u8) -> Option<Self>[src]

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

fn from_u16(n: u16) -> Option<Self>[src]

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

fn from_u32(n: u32) -> Option<Self>[src]

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

fn from_f32(n: f32) -> Option<Self>[src]

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

fn from_f64(n: f64) -> Option<Self>[src]

Converts a f64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

fn from_i128(n: i128) -> Option<Self>[src]

Converts an i128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

fn from_u128(n: u128) -> Option<Self>[src]

Converts an u128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

impl<T: Float + FromStr> FromStr for NotNan<T>[src]

fn from_str(src: &str) -> Result<Self, Self::Err>[src]

Convert a &str to NotNan. Returns an error if the string fails to parse, or if the resulting value is NaN

use ordered_float::NotNan;

assert!("-10".parse::<NotNan<f32>>().is_ok());
assert!("abc".parse::<NotNan<f32>>().is_err());
assert!("NaN".parse::<NotNan<f32>>().is_err());

type Err = ParseNotNanError<T::Err>

The associated error which can be returned from parsing.

impl<T: Float> Hash for NotNan<T>[src]

fn hash<H: Hasher>(&self, state: &mut H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl<T: Float> Mul<&'_ NotNan<T>> for NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the * operator.

fn mul(self, other: &Self) -> Self::Output[src]

Performs the * operation. Read more

impl<T: Float> Mul<&'_ NotNan<T>> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the * operator.

fn mul(self, other: Self) -> Self::Output[src]

Performs the * operation. Read more

impl<T: Float> Mul<&'_ T> for NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the * operator.

fn mul(self, other: &T) -> Self::Output[src]

Performs the * operation. Read more

impl<T: Float> Mul<&'_ T> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the * operator.

fn mul(self, other: &T) -> Self::Output[src]

Performs the * operation. Read more

impl<T: Float> Mul<NotNan<T>> for NotNan<T>[src]

type Output = Self

The resulting type after applying the * operator.

fn mul(self, other: Self) -> Self[src]

Performs the * operation. Read more

impl<T: Float> Mul<NotNan<T>> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the * operator.

fn mul(self, other: NotNan<T>) -> Self::Output[src]

Performs the * operation. Read more

impl<T: Float> Mul<T> for NotNan<T>[src]

Multiplies a float directly.

Panics if the provided value is NaN or the computation results in NaN

type Output = Self

The resulting type after applying the * operator.

fn mul(self, other: T) -> Self[src]

Performs the * operation. Read more

impl<T: Float> Mul<T> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the * operator.

fn mul(self, other: T) -> Self::Output[src]

Performs the * operation. Read more

impl<T: Float + MulAssign> MulAssign<&'_ NotNan<T>> for NotNan<T>[src]

fn mul_assign(&mut self, other: &Self)[src]

Performs the *= operation. Read more

impl<T: Float + MulAssign> MulAssign<&'_ T> for NotNan<T>[src]

fn mul_assign(&mut self, other: &T)[src]

Performs the *= operation. Read more

impl<T: Float + MulAssign> MulAssign<NotNan<T>> for NotNan<T>[src]

fn mul_assign(&mut self, other: Self)[src]

Performs the *= operation. Read more

impl<T: Float + MulAssign> MulAssign<T> for NotNan<T>[src]

fn mul_assign(&mut self, other: T)[src]

Performs the *= operation. Read more

impl<T: Float> Neg for NotNan<T>[src]

type Output = Self

The resulting type after applying the - operator.

fn neg(self) -> Self[src]

Performs the unary - operation. Read more

impl<T: Float> Neg for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the - operator.

fn neg(self) -> Self::Output[src]

Performs the unary - operation. Read more

impl<T: Float> Num for NotNan<T>[src]

type FromStrRadixErr = ParseNotNanError<T::FromStrRadixErr>

fn from_str_radix(src: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>[src]

Convert from a string and radix (typically 2..=36). Read more

impl<T: Float> NumCast for NotNan<T>[src]

fn from<F: ToPrimitive>(n: F) -> Option<Self>[src]

Creates a number from another value that can be converted into a primitive via the ToPrimitive trait. If the source value cannot be represented by the target type, then None is returned. Read more

impl<T: Float> One for NotNan<T>[src]

fn one() -> Self[src]

Returns the multiplicative identity element of Self, 1. Read more

fn set_one(&mut self)[src]

Sets self to the multiplicative identity element of Self, 1.

fn is_one(&self) -> bool where
    Self: PartialEq<Self>, 
[src]

Returns true if self is equal to the multiplicative identity. Read more

impl<T: Float> Ord for NotNan<T>[src]

fn cmp(&self, other: &NotNan<T>) -> Ordering[src]

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

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl<T: PartialEq> PartialEq<NotNan<T>> for NotNan<T>[src]

fn eq(&self, other: &NotNan<T>) -> bool[src]

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

fn ne(&self, other: &NotNan<T>) -> bool[src]

This method tests for !=.

impl<T: Float> PartialEq<T> for NotNan<T>[src]

fn eq(&self, other: &T) -> bool[src]

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

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<T: PartialOrd> PartialOrd<NotNan<T>> for NotNan<T>[src]

fn partial_cmp(&self, other: &NotNan<T>) -> Option<Ordering>[src]

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

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

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

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

#[must_use]
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<'a, T: Float + Product + 'a> Product<&'a NotNan<T>> for NotNan<T>[src]

fn product<I: Iterator<Item = &'a NotNan<T>>>(iter: I) -> Self[src]

Method which takes an iterator and generates Self from the elements by multiplying the items. Read more

impl<T: Float + Product> Product<NotNan<T>> for NotNan<T>[src]

fn product<I: Iterator<Item = NotNan<T>>>(iter: I) -> Self[src]

Method which takes an iterator and generates Self from the elements by multiplying the items. Read more

impl<T: Float> Rem<&'_ NotNan<T>> for NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the % operator.

fn rem(self, other: &Self) -> Self::Output[src]

Performs the % operation. Read more

impl<T: Float> Rem<&'_ NotNan<T>> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the % operator.

fn rem(self, other: Self) -> Self::Output[src]

Performs the % operation. Read more

impl<T: Float> Rem<&'_ T> for NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the % operator.

fn rem(self, other: &T) -> Self::Output[src]

Performs the % operation. Read more

impl<T: Float> Rem<&'_ T> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the % operator.

fn rem(self, other: &T) -> Self::Output[src]

Performs the % operation. Read more

impl<T: Float> Rem<NotNan<T>> for NotNan<T>[src]

type Output = Self

The resulting type after applying the % operator.

fn rem(self, other: Self) -> Self[src]

Performs the % operation. Read more

impl<T: Float> Rem<NotNan<T>> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the % operator.

fn rem(self, other: NotNan<T>) -> Self::Output[src]

Performs the % operation. Read more

impl<T: Float> Rem<T> for NotNan<T>[src]

Calculates % with a float directly.

Panics if the provided value is NaN or the computation results in NaN

type Output = Self

The resulting type after applying the % operator.

fn rem(self, other: T) -> Self[src]

Performs the % operation. Read more

impl<T: Float> Rem<T> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the % operator.

fn rem(self, other: T) -> Self::Output[src]

Performs the % operation. Read more

impl<T: Float + RemAssign> RemAssign<&'_ NotNan<T>> for NotNan<T>[src]

fn rem_assign(&mut self, other: &Self)[src]

Performs the %= operation. Read more

impl<T: Float + RemAssign> RemAssign<&'_ T> for NotNan<T>[src]

fn rem_assign(&mut self, other: &T)[src]

Performs the %= operation. Read more

impl<T: Float + RemAssign> RemAssign<NotNan<T>> for NotNan<T>[src]

fn rem_assign(&mut self, other: Self)[src]

Performs the %= operation. Read more

impl<T: Float + RemAssign> RemAssign<T> for NotNan<T>[src]

fn rem_assign(&mut self, other: T)[src]

Performs the %= operation. Read more

impl<T: Float + Signed> Signed for NotNan<T>[src]

fn abs(&self) -> Self[src]

Computes the absolute value. Read more

fn abs_sub(&self, other: &Self) -> Self[src]

The positive difference of two numbers. Read more

fn signum(&self) -> Self[src]

Returns the sign of the number. Read more

fn is_positive(&self) -> bool[src]

Returns true if the number is positive and false if the number is zero or negative.

fn is_negative(&self) -> bool[src]

Returns true if the number is negative and false if the number is zero or positive.

impl<T: Float> Sub<&'_ NotNan<T>> for NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the - operator.

fn sub(self, other: &Self) -> Self::Output[src]

Performs the - operation. Read more

impl<T: Float> Sub<&'_ NotNan<T>> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the - operator.

fn sub(self, other: Self) -> Self::Output[src]

Performs the - operation. Read more

impl<T: Float> Sub<&'_ T> for NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the - operator.

fn sub(self, other: &T) -> Self::Output[src]

Performs the - operation. Read more

impl<T: Float> Sub<&'_ T> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the - operator.

fn sub(self, other: &T) -> Self::Output[src]

Performs the - operation. Read more

impl<T: Float> Sub<NotNan<T>> for NotNan<T>[src]

type Output = Self

The resulting type after applying the - operator.

fn sub(self, other: Self) -> Self[src]

Performs the - operation. Read more

impl<T: Float> Sub<NotNan<T>> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the - operator.

fn sub(self, other: NotNan<T>) -> Self::Output[src]

Performs the - operation. Read more

impl<T: Float> Sub<T> for NotNan<T>[src]

Subtracts a float directly.

Panics if the provided value is NaN or the computation results in NaN

type Output = Self

The resulting type after applying the - operator.

fn sub(self, other: T) -> Self[src]

Performs the - operation. Read more

impl<T: Float> Sub<T> for &NotNan<T>[src]

type Output = NotNan<T>

The resulting type after applying the - operator.

fn sub(self, other: T) -> Self::Output[src]

Performs the - operation. Read more

impl<T: Float + SubAssign> SubAssign<&'_ NotNan<T>> for NotNan<T>[src]

fn sub_assign(&mut self, other: &Self)[src]

Performs the -= operation. Read more

impl<T: Float + SubAssign> SubAssign<&'_ T> for NotNan<T>[src]

fn sub_assign(&mut self, other: &T)[src]

Performs the -= operation. Read more

impl<T: Float + SubAssign> SubAssign<NotNan<T>> for NotNan<T>[src]

fn sub_assign(&mut self, other: Self)[src]

Performs the -= operation. Read more

impl<T: Float + SubAssign> SubAssign<T> for NotNan<T>[src]

fn sub_assign(&mut self, other: T)[src]

Performs the -= operation. Read more

impl<'a, T: Float + Sum + 'a> Sum<&'a NotNan<T>> for NotNan<T>[src]

fn sum<I: Iterator<Item = &'a NotNan<T>>>(iter: I) -> Self[src]

Method which takes an iterator and generates Self from the elements by “summing up” the items. Read more

impl<T: Float + Sum> Sum<NotNan<T>> for NotNan<T>[src]

Adds a float directly.

Panics if the provided value is NaN.

fn sum<I: Iterator<Item = NotNan<T>>>(iter: I) -> Self[src]

Method which takes an iterator and generates Self from the elements by “summing up” the items. Read more

impl<T: Float> ToPrimitive for NotNan<T>[src]

fn to_i64(&self) -> Option<i64>[src]

Converts the value of self to an i64. If the value cannot be represented by an i64, then None is returned. Read more

fn to_u64(&self) -> Option<u64>[src]

Converts the value of self to a u64. If the value cannot be represented by a u64, then None is returned. Read more

fn to_isize(&self) -> Option<isize>[src]

Converts the value of self to an isize. If the value cannot be represented by an isize, then None is returned. Read more

fn to_i8(&self) -> Option<i8>[src]

Converts the value of self to an i8. If the value cannot be represented by an i8, then None is returned. Read more

fn to_i16(&self) -> Option<i16>[src]

Converts the value of self to an i16. If the value cannot be represented by an i16, then None is returned. Read more

fn to_i32(&self) -> Option<i32>[src]

Converts the value of self to an i32. If the value cannot be represented by an i32, then None is returned. Read more

fn to_usize(&self) -> Option<usize>[src]

Converts the value of self to a usize. If the value cannot be represented by a usize, then None is returned. Read more

fn to_u8(&self) -> Option<u8>[src]

Converts the value of self to a u8. If the value cannot be represented by a u8, then None is returned. Read more

fn to_u16(&self) -> Option<u16>[src]

Converts the value of self to a u16. If the value cannot be represented by a u16, then None is returned. Read more

fn to_u32(&self) -> Option<u32>[src]

Converts the value of self to a u32. If the value cannot be represented by a u32, then None is returned. Read more

fn to_f32(&self) -> Option<f32>[src]

Converts the value of self to an f32. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f32. Read more

fn to_f64(&self) -> Option<f64>[src]

Converts the value of self to an f64. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f64. Read more

fn to_i128(&self) -> Option<i128>[src]

Converts the value of self to an i128. If the value cannot be represented by an i128 (i64 under the default implementation), then None is returned. Read more

fn to_u128(&self) -> Option<u128>[src]

Converts the value of self to a u128. If the value cannot be represented by a u128 (u64 under the default implementation), then None is returned. Read more

impl TryFrom<f32> for NotNan<f32>[src]

type Error = FloatIsNan

The type returned in the event of a conversion error.

fn try_from(v: f32) -> Result<Self, Self::Error>[src]

Performs the conversion.

impl TryFrom<f64> for NotNan<f64>[src]

type Error = FloatIsNan

The type returned in the event of a conversion error.

fn try_from(v: f64) -> Result<Self, Self::Error>[src]

Performs the conversion.

impl<T: Float> Zero for NotNan<T>[src]

fn zero() -> Self[src]

Returns the additive identity element of Self, 0. Read more

fn is_zero(&self) -> bool[src]

Returns true if self is equal to the additive identity.

fn set_zero(&mut self)[src]

Sets self to the additive identity element of Self, 0.

impl<T: Copy> Copy for NotNan<T>[src]

impl<T: Float + PartialEq> Eq for NotNan<T>[src]

impl<T> StructuralPartialEq for NotNan<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for NotNan<T> where
    T: RefUnwindSafe

impl<T> Send for NotNan<T> where
    T: Send

impl<T> Sync for NotNan<T> where
    T: Sync

impl<T> Unpin for NotNan<T> where
    T: Unpin

impl<T> UnwindSafe for NotNan<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> NumAssign for T where
    T: Num + NumAssignOps<T>, 
[src]

impl<T, Rhs> NumAssignOps<Rhs> for T where
    T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>, 
[src]

impl<T> NumAssignRef for T where
    T: NumAssign + for<'r> NumAssignOps<&'r T>, 
[src]

impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
    T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>, 
[src]

impl<T> NumRef for T where
    T: Num + for<'r> NumOps<&'r T, T>, 
[src]

impl<T, Base> RefNum<Base> for T where
    T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>, 
[src]