Struct ordered_float::NotNan [−][src]
#[repr(transparent)]pub struct NotNan<T>(_);
A wrapper around Floats providing an implementation of Ord and Hash.
A NaN value cannot be stored in this type.
Implementations
impl<T> NotNan<T>
[src]
impl<T> NotNan<T>
[src]pub const unsafe fn unchecked_new(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
impl<T: Float> NotNan<T>
[src]
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 fn into_inner(self) -> T
[src]
Get the value out.
Trait Implementations
impl<T: Float> Add<NotNan<T>> for NotNan<T>
[src]
impl<T: Float> Add<NotNan<T>> for NotNan<T>
[src]Adds two NotNans.
Panics if the computation results in NaN
impl<T: Float> Add<T> for NotNan<T>
[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
impl<T: Float + AddAssign> AddAssign<NotNan<T>> for NotNan<T>
[src]
impl<T: Float + AddAssign> AddAssign<NotNan<T>> for NotNan<T>
[src]fn add_assign(&mut self, other: Self)
[src]
impl<T: Float + AddAssign> AddAssign<T> for NotNan<T>
[src]
impl<T: Float + AddAssign> AddAssign<T> for NotNan<T>
[src]Adds a float directly.
Panics if the provided value is NaN.
fn add_assign(&mut self, other: T)
[src]
impl<T: Float> Div<T> for NotNan<T>
[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
impl<T: Float + DivAssign> DivAssign<NotNan<T>> for NotNan<T>
[src]
impl<T: Float + DivAssign> DivAssign<NotNan<T>> for NotNan<T>
[src]fn div_assign(&mut self, other: Self)
[src]
impl<T: Float + DivAssign> DivAssign<T> for NotNan<T>
[src]
impl<T: Float + DivAssign> DivAssign<T> for NotNan<T>
[src]Divides a float directly.
Panics if the provided value is NaN or the computation results in NaN
fn div_assign(&mut self, other: T)
[src]
impl<T: Float + FromPrimitive> FromPrimitive for NotNan<T>
[src]
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]
pub fn from_i128(n: i128) -> Option<Self>
[src]
pub fn from_u128(n: u128) -> Option<Self>
[src]
impl<T: Float + FromStr> FromStr for NotNan<T>
[src]
impl<T: Float + FromStr> FromStr for NotNan<T>
[src]type Err = ParseNotNanError<T::Err>
The associated error which can be returned from parsing.
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());
impl<T: Float> Mul<T> for NotNan<T>
[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
impl<T: Float + MulAssign> MulAssign<NotNan<T>> for NotNan<T>
[src]
impl<T: Float + MulAssign> MulAssign<NotNan<T>> for NotNan<T>
[src]fn mul_assign(&mut self, other: Self)
[src]
impl<T: Float + MulAssign> MulAssign<T> for NotNan<T>
[src]
impl<T: Float + MulAssign> MulAssign<T> for NotNan<T>
[src]Multiplies a float directly.
Panics if the provided value is NaN.
fn mul_assign(&mut self, other: T)
[src]
impl<T: Float> Num for NotNan<T>
[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: PartialOrd> PartialOrd<NotNan<T>> for NotNan<T>
[src]
impl<T: PartialOrd> PartialOrd<NotNan<T>> for NotNan<T>
[src]impl<T: Float> Rem<T> for NotNan<T>
[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
impl<T: Float + RemAssign> RemAssign<NotNan<T>> for NotNan<T>
[src]
impl<T: Float + RemAssign> RemAssign<NotNan<T>> for NotNan<T>
[src]fn rem_assign(&mut self, other: Self)
[src]
impl<T: Float + RemAssign> RemAssign<T> for NotNan<T>
[src]
impl<T: Float + RemAssign> RemAssign<T> for NotNan<T>
[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: T)
[src]
impl<T> StructuralPartialEq for NotNan<T>
[src]
impl<T> StructuralPartialEq for NotNan<T>
[src]impl<T: Float> Sub<T> for NotNan<T>
[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
impl<T: Float + SubAssign> SubAssign<NotNan<T>> for NotNan<T>
[src]
impl<T: Float + SubAssign> SubAssign<NotNan<T>> for NotNan<T>
[src]fn sub_assign(&mut self, other: Self)
[src]
impl<T: Float + SubAssign> SubAssign<T> for NotNan<T>
[src]
impl<T: Float + SubAssign> SubAssign<T> for NotNan<T>
[src]Subtracts a float directly.
Panics if the provided value is NaN or the computation results in NaN
fn sub_assign(&mut self, other: T)
[src]
impl<T: Float> ToPrimitive 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]
pub fn to_i128(&self) -> Option<i128>
[src]
pub fn to_u128(&self) -> Option<u128>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for NotNan<T> where
T: RefUnwindSafe,
impl<T> RefUnwindSafe for NotNan<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for NotNan<T> where
T: UnwindSafe,
impl<T> UnwindSafe for NotNan<T> where
T: UnwindSafe,
Blanket Implementations
impl<T> NumAssign for T where
T: Num + NumAssignOps<T>,
[src]
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, Rhs> NumAssignOps<Rhs> for T where
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,
[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, 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]