Struct ordered_float::NotNan [−][src]
A wrapper around Floats providing an implementation of Ord and Hash.
A NaN value cannot be stored in this type.
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
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: 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 + 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]
Adds a float directly.
Panics if the provided value is NaN.
fn add_assign(&mut self, other: T)
[src]
impl<T: Float> AsRef<T> for NotNan<T>
[src]
impl<T: Float> Bounded for NotNan<T>
[src]
impl<T: Clone + Float> Clone for NotNan<T>
[src]
impl<T: Copy + Float> Copy for NotNan<T>
[src]
impl<T: Debug + Float> Debug for NotNan<T>
[src]
impl<T: Default + Float> Default for NotNan<T>
[src]
impl<T: Float> Deref for NotNan<T>
[src]
impl<T: Float + Display> Display for NotNan<T>
[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 + 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]
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 + PartialEq> Eq 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 + 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]
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> Hash for NotNan<T>
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
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 + 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]
Multiplies a float directly.
Panics if the provided value is NaN.
fn mul_assign(&mut self, other: T)
[src]
impl<T: Float> Neg 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: Float> NumCast for NotNan<T>
[src]
fn from<F: ToPrimitive>(n: F) -> Option<Self>
[src]
impl<T: Float> One for NotNan<T>
[src]
fn one() -> Self
[src]
pub fn set_one(&mut self)
[src]
pub fn is_one(&self) -> bool where
Self: PartialEq<Self>,
[src]
Self: PartialEq<Self>,
impl<T: Float> Ord for NotNan<T>
[src]
fn cmp(&self, other: &NotNan<T>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T: PartialEq + Float> PartialEq<NotNan<T>> for NotNan<T>
[src]
impl<T: PartialOrd + Float> PartialOrd<NotNan<T>> for NotNan<T>
[src]
fn partial_cmp(&self, other: &NotNan<T>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a, T: Float + Product> Product<&'a NotNan<T>> for NotNan<T>
[src]
impl<T: Float + Product> Product<NotNan<T>> for NotNan<T>
[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 + 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]
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: Float + Signed> Signed for NotNan<T>
[src]
fn abs(&self) -> Self
[src]
fn abs_sub(&self, other: &Self) -> Self
[src]
fn signum(&self) -> Self
[src]
fn is_positive(&self) -> bool
[src]
fn is_negative(&self) -> bool
[src]
impl<T: Float> StructuralPartialEq for NotNan<T>
[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 + 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]
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<'a, T: Float + Sum> Sum<&'a NotNan<T>> for NotNan<T>
[src]
impl<T: Float + Sum> Sum<NotNan<T>> 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]
impl<T: Float> Zero for NotNan<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for NotNan<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for NotNan<T> where
T: Send,
T: Send,
impl<T> Sync for NotNan<T> where
T: Sync,
T: Sync,
impl<T> Unpin for NotNan<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for NotNan<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<!> for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> NumAssign for T where
T: Num + NumAssignOps<T>,
[src]
T: Num + NumAssignOps<T>,
impl<T, Rhs> NumAssignOps<Rhs> 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, 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]
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,