[−][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]
pub fn new(val: T) -> Result<Self, FloatIsNan>
[src]
Create a NotNan value.
Returns Err if val is NaN
pub unsafe fn unchecked_new(val: T) -> Self
[src]
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]
Get the value out.
Trait Implementations
impl<T: Clone + Float> Clone for NotNan<T>
[src]
fn clone(&self) -> NotNan<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Float + Display> Display for NotNan<T>
[src]
impl<T: Debug + Float> Debug for NotNan<T>
[src]
impl<T: PartialEq + Float> PartialEq<NotNan<T>> for NotNan<T>
[src]
impl<T: Float + PartialEq> Eq for NotNan<T>
[src]
impl<T: Float> Ord for NotNan<T>
[src]
fn cmp(&self, other: &NotNan<T>) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
impl<T: PartialOrd + Float> PartialOrd<NotNan<T>> for NotNan<T>
[src]
fn partial_cmp(&self, other: &NotNan<T>) -> Option<Ordering>
[src]
fn lt(&self, other: &NotNan<T>) -> bool
[src]
fn le(&self, other: &NotNan<T>) -> bool
[src]
fn gt(&self, other: &NotNan<T>) -> bool
[src]
fn ge(&self, other: &NotNan<T>) -> bool
[src]
impl<T: Float> Hash for NotNan<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,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: Copy + Float> Copy for NotNan<T>
[src]
impl<T: Float> From<T> for NotNan<T>
[src]
Creates a NotNan value from a Float.
Panics if the provided value is NaN or the computation results in NaN
impl<T: Float> Add<NotNan<T>> for NotNan<T>
[src]
Adds two NotNans.
Panics if the computation results in NaN
type Output = Self
The resulting type after applying the +
operator.
fn add(self, other: Self) -> Self
[src]
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]
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]
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]
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]
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]
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]
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]
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]
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]
impl<T: Float> Neg for NotNan<T>
[src]
impl AddAssign<NotNan<f64>> for NotNan<f64>
[src]
fn add_assign(&mut self, other: Self)
[src]
impl AddAssign<NotNan<f32>> for NotNan<f32>
[src]
fn add_assign(&mut self, other: Self)
[src]
impl AddAssign<f64> for NotNan<f64>
[src]
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]
impl AddAssign<f32> for NotNan<f32>
[src]
Adds a float directly.
Panics if the provided value is NaN.
fn add_assign(&mut self, other: f32)
[src]
impl SubAssign<NotNan<f64>> for NotNan<f64>
[src]
fn sub_assign(&mut self, other: Self)
[src]
impl SubAssign<NotNan<f32>> for NotNan<f32>
[src]
fn sub_assign(&mut self, other: Self)
[src]
impl SubAssign<f64> for NotNan<f64>
[src]
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]
impl SubAssign<f32> for NotNan<f32>
[src]
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]
impl MulAssign<NotNan<f64>> for NotNan<f64>
[src]
fn mul_assign(&mut self, other: Self)
[src]
impl MulAssign<NotNan<f32>> for NotNan<f32>
[src]
fn mul_assign(&mut self, other: Self)
[src]
impl MulAssign<f64> for NotNan<f64>
[src]
Multiplies a float directly.
Panics if the provided value is NaN.
fn mul_assign(&mut self, other: f64)
[src]
impl MulAssign<f32> for NotNan<f32>
[src]
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]
impl DivAssign<NotNan<f64>> for NotNan<f64>
[src]
fn div_assign(&mut self, other: Self)
[src]
impl DivAssign<NotNan<f32>> for NotNan<f32>
[src]
fn div_assign(&mut self, other: Self)
[src]
impl DivAssign<f64> for NotNan<f64>
[src]
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]
impl DivAssign<f32> for NotNan<f32>
[src]
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]
impl RemAssign<NotNan<f64>> for NotNan<f64>
[src]
fn rem_assign(&mut self, other: Self)
[src]
impl RemAssign<NotNan<f32>> for NotNan<f32>
[src]
fn rem_assign(&mut self, other: Self)
[src]
impl RemAssign<f64> for NotNan<f64>
[src]
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]
impl RemAssign<f32> for NotNan<f32>
[src]
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]
impl<T: Float> Deref for NotNan<T>
[src]
impl<T: Default + Float> Default for NotNan<T>
[src]
impl Into<f32> for NotNan<f32>
[src]
impl Into<f64> for NotNan<f64>
[src]
impl<T: Float> AsRef<T> for NotNan<T>
[src]
impl<T: Float> Bounded for NotNan<T>
[src]
impl<T: Float> ToPrimitive for NotNan<T>
[src]
fn to_i64(&self) -> Option<i64>
[src]
fn to_u64(&self) -> Option<u64>
[src]
fn to_isize(&self) -> Option<isize>
[src]
fn to_i8(&self) -> Option<i8>
[src]
fn to_i16(&self) -> Option<i16>
[src]
fn to_i32(&self) -> Option<i32>
[src]
fn to_usize(&self) -> Option<usize>
[src]
fn to_u8(&self) -> Option<u8>
[src]
fn to_u16(&self) -> Option<u16>
[src]
fn to_u32(&self) -> Option<u32>
[src]
fn to_f32(&self) -> Option<f32>
[src]
fn to_f64(&self) -> Option<f64>
[src]
fn to_i128(&self) -> Option<i128>
[src]
Converts the value of self
to an i128
. Read more
fn to_u128(&self) -> Option<u128>
[src]
Converts the value of self
to an u128
. Read more
impl<T: Float + FromPrimitive> FromPrimitive for NotNan<T>
[src]
fn from_i64(n: i64) -> Option<Self>
[src]
fn from_u64(n: u64) -> Option<Self>
[src]
fn from_isize(n: isize) -> Option<Self>
[src]
fn from_i8(n: i8) -> Option<Self>
[src]
fn from_i16(n: i16) -> Option<Self>
[src]
fn from_i32(n: i32) -> Option<Self>
[src]
fn from_usize(n: usize) -> Option<Self>
[src]
fn from_u8(n: u8) -> Option<Self>
[src]
fn from_u16(n: u16) -> Option<Self>
[src]
fn from_u32(n: u32) -> Option<Self>
[src]
fn from_f32(n: f32) -> Option<Self>
[src]
fn from_f64(n: f64) -> Option<Self>
[src]
fn from_i128(n: i128) -> Option<Self>
[src]
Convert an i128
to return an optional value of this type. If the type cannot be represented by this value, then None
is returned. Read more
fn from_u128(n: u128) -> Option<Self>
[src]
Convert an u128
to return an optional value of this type. If the type cannot be represented by this value, then None
is returned. Read more
impl<T: Float> NumCast for NotNan<T>
[src]
fn from<F: ToPrimitive>(n: F) -> Option<Self>
[src]
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]
impl<T: Float> Zero for NotNan<T>
[src]
impl<T: Float> One for NotNan<T>
[src]
fn one() -> Self
[src]
fn is_one(&self) -> bool where
Self: PartialEq<Self>,
[src]
Self: PartialEq<Self>,
Returns true
if self
is equal to the multiplicative identity. Read more
impl<T: Float + Signed> Signed for NotNan<T>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T> From for T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
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]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[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>,
[src]
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]
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,
impl<T> NumAssign for T where
T: Num + NumAssignOps<T>,
[src]
T: Num + NumAssignOps<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,