[−][src]Struct ordered_float::NotNaN
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) -> Self
Create 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) -> T
Get the value out.
Trait Implementations
impl<T: PartialOrd + Float> PartialOrd<NotNaN<T>> for NotNaN<T>
[src]
impl<T: PartialOrd + Float> PartialOrd<NotNaN<T>> 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>) -> bool
This 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>) -> bool
This 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>) -> bool
This 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>) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T: PartialEq + Float> PartialEq<NotNaN<T>> for NotNaN<T>
[src]
impl<T: PartialEq + Float> PartialEq<NotNaN<T>> for NotNaN<T>
fn eq(&self, other: &NotNaN<T>) -> bool
[src]
fn eq(&self, other: &NotNaN<T>) -> bool
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]
fn ne(&self, other: &NotNaN<T>) -> bool
This method tests for !=
.
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: Float> AsRef<T> for NotNaN<T>
[src]
impl<T: Float> AsRef<T> for NotNaN<T>
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 + 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>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl<T: Copy + Float> Copy for NotNaN<T>
[src]
impl<T: Copy + Float> Copy for NotNaN<T>
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 + PartialEq> Eq for NotNaN<T>
[src]
impl<T: Float + PartialEq> Eq for NotNaN<T>
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) -> Result
Formats the value using the given formatter. Read more
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) -> Result
Formats the value using the given formatter. Read more
impl<T: Float> Sub<NotNaN<T>> for NotNaN<T>
[src]
impl<T: Float> Sub<NotNaN<T>> 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) -> Self
Performs 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) -> Self
Performs the -
operation.
impl<T: Float> Add<NotNaN<T>> for NotNaN<T>
[src]
impl<T: Float> Add<NotNaN<T>> 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) -> Self
Performs 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) -> Self
Performs the +
operation.
impl<T: Float> Mul<NotNaN<T>> for NotNaN<T>
[src]
impl<T: Float> Mul<NotNaN<T>> 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) -> Self
Performs 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) -> Self
Performs the *
operation.
impl<T: Float> Div<NotNaN<T>> for NotNaN<T>
[src]
impl<T: Float> Div<NotNaN<T>> 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) -> Self
Performs 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) -> Self
Performs the /
operation.
impl<T: Float> Rem<NotNaN<T>> for NotNaN<T>
[src]
impl<T: Float> Rem<NotNaN<T>> 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) -> Self
Performs 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) -> Self
Performs the %
operation.
impl<T: Float> Neg for NotNaN<T>
[src]
impl<T: Float> Neg for NotNaN<T>
type Output = Self
The resulting type after applying the -
operator.
fn neg(self) -> Self
[src]
fn neg(self) -> Self
Performs the unary -
operation.
impl AddAssign<NotNaN<f64>> for NotNaN<f64>
[src]
impl AddAssign<NotNaN<f64>> for NotNaN<f64>
fn add_assign(&mut self, other: Self)
[src]
fn add_assign(&mut self, other: Self)
Performs the +=
operation.
impl AddAssign<NotNaN<f32>> for NotNaN<f32>
[src]
impl AddAssign<NotNaN<f32>> 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 SubAssign<NotNaN<f64>> for NotNaN<f64>
[src]
impl SubAssign<NotNaN<f64>> for NotNaN<f64>
fn sub_assign(&mut self, other: Self)
[src]
fn sub_assign(&mut self, other: Self)
Performs the -=
operation.
impl SubAssign<NotNaN<f32>> for NotNaN<f32>
[src]
impl SubAssign<NotNaN<f32>> 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 MulAssign<NotNaN<f64>> for NotNaN<f64>
[src]
impl MulAssign<NotNaN<f64>> for NotNaN<f64>
fn mul_assign(&mut self, other: Self)
[src]
fn mul_assign(&mut self, other: Self)
Performs the *=
operation.
impl MulAssign<NotNaN<f32>> for NotNaN<f32>
[src]
impl MulAssign<NotNaN<f32>> 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 DivAssign<NotNaN<f64>> for NotNaN<f64>
[src]
impl DivAssign<NotNaN<f64>> for NotNaN<f64>
fn div_assign(&mut self, other: Self)
[src]
fn div_assign(&mut self, other: Self)
Performs the /=
operation.
impl DivAssign<NotNaN<f32>> for NotNaN<f32>
[src]
impl DivAssign<NotNaN<f32>> 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 RemAssign<NotNaN<f64>> for NotNaN<f64>
[src]
impl RemAssign<NotNaN<f64>> for NotNaN<f64>
fn rem_assign(&mut self, other: Self)
[src]
fn rem_assign(&mut self, other: Self)
Performs the %=
operation.
impl RemAssign<NotNaN<f32>> for NotNaN<f32>
[src]
impl RemAssign<NotNaN<f32>> 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> 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::Target
Dereferences the value.
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 + Serialize> Serialize for NotNaN<T>
[src]
impl<T: Float + Serialize> Serialize for NotNaN<T>
fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>
[src]
fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>
Serialize this value into the given Serde serializer. Read more
impl<'de, T: Float + Deserialize<'de>> Deserialize<'de> for NotNaN<T>
[src]
impl<'de, T: Float + Deserialize<'de>> Deserialize<'de> for NotNaN<T>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
[src]
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 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]
impl<T> ToString for T where
T: Display + ?Sized,
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T, Rhs, Output> NumOps 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, Rhs, Output> NumOps for T where
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,
impl<T, Rhs> NumAssignOps for T where
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,
[src]
impl<T, Rhs> NumAssignOps for T where
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,