Struct ordered_float::NotNaN [−][src]
pub struct NotNaN<T: Float>(_);
A wrapper around Floats providing an implementation of Ord and Hash.
A NaN value cannot be stored in this type.
Methods
impl<T: Float> NotNaN<T>[src]
impl<T: Float> NotNaN<T>pub fn new(val: T) -> Result<Self, FloatIsNaN>[src]
pub fn new(val: T) -> Result<Self, FloatIsNaN>Create a NotNaN value.
Returns Err if val is NaN
pub unsafe fn unchecked_new(val: T) -> Self[src]
pub unsafe fn unchecked_new(val: T) -> SelfCreate a NotNaN value from a value that is guaranteed to not be NaN
Behaviour is undefined if val is NaN
pub fn into_inner(self) -> T[src]
pub fn into_inner(self) -> TGet the value out.
Trait Implementations
impl<T: PartialOrd + Float> PartialOrd for NotNaN<T>[src]
impl<T: PartialOrd + Float> PartialOrd for NotNaN<T>fn partial_cmp(&self, other: &NotNaN<T>) -> Option<Ordering>[src]
fn partial_cmp(&self, other: &NotNaN<T>) -> Option<Ordering>This method returns an ordering between self and other values if one exists. Read more
fn lt(&self, other: &NotNaN<T>) -> bool[src]
fn lt(&self, other: &NotNaN<T>) -> boolThis method tests less than (for self and other) and is used by the < operator. Read more
fn le(&self, other: &NotNaN<T>) -> bool[src]
fn le(&self, other: &NotNaN<T>) -> boolThis method tests less than or equal to (for self and other) and is used by the <= operator. Read more
fn gt(&self, other: &NotNaN<T>) -> bool[src]
fn gt(&self, other: &NotNaN<T>) -> boolThis method tests greater than (for self and other) and is used by the > operator. Read more
fn ge(&self, other: &NotNaN<T>) -> bool[src]
fn ge(&self, other: &NotNaN<T>) -> boolThis method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
impl<T: PartialEq + Float> PartialEq for NotNaN<T>[src]
impl<T: PartialEq + Float> PartialEq for NotNaN<T>fn eq(&self, other: &NotNaN<T>) -> bool[src]
fn eq(&self, other: &NotNaN<T>) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &NotNaN<T>) -> bool[src]
fn ne(&self, other: &NotNaN<T>) -> boolThis method tests for !=.
impl<T: Debug + Float> Debug for NotNaN<T>[src]
impl<T: Debug + Float> Debug for NotNaN<T>fn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<T: Default + Float> Default for NotNaN<T>[src]
impl<T: Default + Float> Default for NotNaN<T>impl<T: Clone + Float> Clone for NotNaN<T>[src]
impl<T: Clone + Float> Clone for NotNaN<T>fn clone(&self) -> NotNaN<T>[src]
fn clone(&self) -> NotNaN<T>Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl<T: Copy + Float> Copy for NotNaN<T>[src]
impl<T: Copy + Float> Copy for NotNaN<T>impl<T: Float> AsRef<T> for NotNaN<T>[src]
impl<T: Float> AsRef<T> for NotNaN<T>impl<T: Float + PartialOrd> Ord for NotNaN<T>[src]
impl<T: Float + PartialOrd> Ord for NotNaN<T>fn cmp(&self, other: &NotNaN<T>) -> Ordering[src]
fn cmp(&self, other: &NotNaN<T>) -> OrderingThis method returns an Ordering between self and other. Read more
fn max(self, other: Self) -> Self1.21.0[src]
fn max(self, other: Self) -> SelfCompares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self1.21.0[src]
fn min(self, other: Self) -> SelfCompares and returns the minimum of two values. Read more
impl<T: Float> Hash for NotNaN<T>[src]
impl<T: Float> Hash for NotNaN<T>fn hash<H: Hasher>(&self, state: &mut H)[src]
fn hash<H: Hasher>(&self, state: &mut H)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]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, Feeds a slice of this type into the given [Hasher]. Read more
impl<T: Float + Display> Display for NotNaN<T>[src]
impl<T: Float + Display> Display for NotNaN<T>fn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Into<f32> for NotNaN<f32>[src]
impl Into<f32> for NotNaN<f32>impl Into<f64> for NotNaN<f64>[src]
impl Into<f64> for NotNaN<f64>impl<T: Float> From<T> for NotNaN<T>[src]
impl<T: Float> From<T> for NotNaN<T>Creates a NotNaN value from a Float.
Panics if the provided value is NaN or the computation results in NaN
impl<T: Float> Deref for NotNaN<T>[src]
impl<T: Float> Deref for NotNaN<T>type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target[src]
fn deref(&self) -> &Self::TargetDereferences the value.
impl<T: Float + PartialEq> Eq for NotNaN<T>[src]
impl<T: Float + PartialEq> Eq for NotNaN<T>impl<T: Float> Add for NotNaN<T>[src]
impl<T: Float> Add for NotNaN<T>type Output = Self
The resulting type after applying the + operator.
fn add(self, other: Self) -> Self[src]
fn add(self, other: Self) -> SelfPerforms the + operation.
impl<T: Float> Add<T> for NotNaN<T>[src]
impl<T: Float> Add<T> for NotNaN<T>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]
fn add(self, other: T) -> SelfPerforms the + operation.
impl AddAssign for NotNaN<f64>[src]
impl AddAssign for NotNaN<f64>fn add_assign(&mut self, other: Self)[src]
fn add_assign(&mut self, other: Self)Performs the += operation.
impl AddAssign for NotNaN<f32>[src]
impl AddAssign for NotNaN<f32>fn add_assign(&mut self, other: Self)[src]
fn add_assign(&mut self, other: Self)Performs the += operation.
impl AddAssign<f64> for NotNaN<f64>[src]
impl AddAssign<f64> for NotNaN<f64>Adds a float directly.
Panics if the provided value is NaN or the computation results in NaN
fn add_assign(&mut self, other: f64)[src]
fn add_assign(&mut self, other: f64)Performs the += operation.
impl AddAssign<f32> for NotNaN<f32>[src]
impl AddAssign<f32> for NotNaN<f32>Adds a float directly.
Panics if the provided value is NaN.
fn add_assign(&mut self, other: f32)[src]
fn add_assign(&mut self, other: f32)Performs the += operation.
impl<T: Float> Sub for NotNaN<T>[src]
impl<T: Float> Sub for NotNaN<T>type Output = Self
The resulting type after applying the - operator.
fn sub(self, other: Self) -> Self[src]
fn sub(self, other: Self) -> SelfPerforms the - operation.
impl<T: Float> Sub<T> for NotNaN<T>[src]
impl<T: Float> Sub<T> for NotNaN<T>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]
fn sub(self, other: T) -> SelfPerforms the - operation.
impl SubAssign for NotNaN<f64>[src]
impl SubAssign for NotNaN<f64>fn sub_assign(&mut self, other: Self)[src]
fn sub_assign(&mut self, other: Self)Performs the -= operation.
impl SubAssign for NotNaN<f32>[src]
impl SubAssign for NotNaN<f32>fn sub_assign(&mut self, other: Self)[src]
fn sub_assign(&mut self, other: Self)Performs the -= operation.
impl SubAssign<f64> for NotNaN<f64>[src]
impl SubAssign<f64> for NotNaN<f64>Subtracts a float directly.
Panics if the provided value is NaN or the computation results in NaN
fn sub_assign(&mut self, other: f64)[src]
fn sub_assign(&mut self, other: f64)Performs the -= operation.
impl SubAssign<f32> for NotNaN<f32>[src]
impl SubAssign<f32> for NotNaN<f32>Subtracts a float directly.
Panics if the provided value is NaN or the computation results in NaN
fn sub_assign(&mut self, other: f32)[src]
fn sub_assign(&mut self, other: f32)Performs the -= operation.
impl<T: Float> Mul for NotNaN<T>[src]
impl<T: Float> Mul for NotNaN<T>type Output = Self
The resulting type after applying the * operator.
fn mul(self, other: Self) -> Self[src]
fn mul(self, other: Self) -> SelfPerforms the * operation.
impl<T: Float> Mul<T> for NotNaN<T>[src]
impl<T: Float> Mul<T> for NotNaN<T>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]
fn mul(self, other: T) -> SelfPerforms the * operation.
impl MulAssign for NotNaN<f64>[src]
impl MulAssign for NotNaN<f64>fn mul_assign(&mut self, other: Self)[src]
fn mul_assign(&mut self, other: Self)Performs the *= operation.
impl MulAssign for NotNaN<f32>[src]
impl MulAssign for NotNaN<f32>fn mul_assign(&mut self, other: Self)[src]
fn mul_assign(&mut self, other: Self)Performs the *= operation.
impl MulAssign<f64> for NotNaN<f64>[src]
impl MulAssign<f64> for NotNaN<f64>Multiplies a float directly.
Panics if the provided value is NaN.
fn mul_assign(&mut self, other: f64)[src]
fn mul_assign(&mut self, other: f64)Performs the *= operation.
impl MulAssign<f32> for NotNaN<f32>[src]
impl MulAssign<f32> for NotNaN<f32>Multiplies a float directly.
Panics if the provided value is NaN or the computation results in NaN
fn mul_assign(&mut self, other: f32)[src]
fn mul_assign(&mut self, other: f32)Performs the *= operation.
impl<T: Float> Div for NotNaN<T>[src]
impl<T: Float> Div for NotNaN<T>type Output = Self
The resulting type after applying the / operator.
fn div(self, other: Self) -> Self[src]
fn div(self, other: Self) -> SelfPerforms the / operation.
impl<T: Float> Div<T> for NotNaN<T>[src]
impl<T: Float> Div<T> for NotNaN<T>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]
fn div(self, other: T) -> SelfPerforms the / operation.
impl DivAssign for NotNaN<f64>[src]
impl DivAssign for NotNaN<f64>fn div_assign(&mut self, other: Self)[src]
fn div_assign(&mut self, other: Self)Performs the /= operation.
impl DivAssign for NotNaN<f32>[src]
impl DivAssign for NotNaN<f32>fn div_assign(&mut self, other: Self)[src]
fn div_assign(&mut self, other: Self)Performs the /= operation.
impl DivAssign<f64> for NotNaN<f64>[src]
impl DivAssign<f64> for NotNaN<f64>Divides a float directly.
Panics if the provided value is NaN or the computation results in NaN
fn div_assign(&mut self, other: f64)[src]
fn div_assign(&mut self, other: f64)Performs the /= operation.
impl DivAssign<f32> for NotNaN<f32>[src]
impl DivAssign<f32> for NotNaN<f32>Divides a float directly.
Panics if the provided value is NaN or the computation results in NaN
fn div_assign(&mut self, other: f32)[src]
fn div_assign(&mut self, other: f32)Performs the /= operation.
impl<T: Float> Rem for NotNaN<T>[src]
impl<T: Float> Rem for NotNaN<T>type Output = Self
The resulting type after applying the % operator.
fn rem(self, other: Self) -> Self[src]
fn rem(self, other: Self) -> SelfPerforms the % operation.
impl<T: Float> Rem<T> for NotNaN<T>[src]
impl<T: Float> Rem<T> for NotNaN<T>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]
fn rem(self, other: T) -> SelfPerforms the % operation.
impl RemAssign for NotNaN<f64>[src]
impl RemAssign for NotNaN<f64>fn rem_assign(&mut self, other: Self)[src]
fn rem_assign(&mut self, other: Self)Performs the %= operation.
impl RemAssign for NotNaN<f32>[src]
impl RemAssign for NotNaN<f32>fn rem_assign(&mut self, other: Self)[src]
fn rem_assign(&mut self, other: Self)Performs the %= operation.
impl RemAssign<f64> for NotNaN<f64>[src]
impl RemAssign<f64> for NotNaN<f64>Calculates %= with a float directly.
Panics if the provided value is NaN or the computation results in NaN
fn rem_assign(&mut self, other: f64)[src]
fn rem_assign(&mut self, other: f64)Performs the %= operation.
impl RemAssign<f32> for NotNaN<f32>[src]
impl RemAssign<f32> for NotNaN<f32>Calculates %= with a float directly.
Panics if the provided value is NaN or the computation results in NaN
fn rem_assign(&mut self, other: f32)[src]
fn rem_assign(&mut self, other: f32)Performs the %= operation.
impl<T: Float> Neg for NotNaN<T>[src]
impl<T: Float> Neg for NotNaN<T>