ordered_float

Struct NotNan

source
pub struct NotNan<T>(/* private fields */);
Expand description

A wrapper around floats providing an implementation of Eq, Ord and Hash.

A NaN value cannot be stored in this type.

use ordered_float::NotNan;

let mut v = [
    NotNan::new(2.0).unwrap(),
    NotNan::new(1.0).unwrap(),
];
v.sort();
assert_eq!(v, [1.0, 2.0]);

Because NotNan implements Ord and Eq, it can be used as a key in a HashSet, HashMap, BTreeMap, or BTreeSet (unlike the primitive f32 or f64 types):

let mut s: HashSet<NotNan<f32>> = HashSet::new();
let key = NotNan::new(1.0).unwrap();
s.insert(key);
assert!(s.contains(&key));

-0.0 and +0.0 are still considered equal. This different sign may show up in printing, or when dividing by zero (the sign of the zero becomes the sign of the resulting infinity). Therefore, NotNan may be unsuitable for use as a key in interning and memoization applications which require equal results from equal inputs, unless signed zeros make no difference or are canonicalized before insertion.

Arithmetic on NotNan values will panic if it produces a NaN value:

let a = NotNan::new(std::f32::INFINITY).unwrap();
let b = NotNan::new(std::f32::NEG_INFINITY).unwrap();

// This will panic:
let c = a + b;

§Representation

NotNan has #[repr(transparent)], so it is sound to use transmute or pointer casts to convert between any type T and NotNan<T>, as long as this does not create a NaN value. However, consider using bytemuck as a safe alternative if possible.

Implementations§

source§

impl<T: FloatCore> NotNan<T>

source

pub fn new(val: T) -> Result<Self, FloatIsNan>

Create a NotNan value.

Returns Err if val is NaN

source§

impl<T> NotNan<T>

source

pub fn into_inner(self) -> T

Get the value out.

source

pub const unsafe fn new_unchecked(val: T) -> Self

Create a NotNan value from a value that is guaranteed to not be NaN

§Safety

Behaviour is undefined if val is NaN

source

pub const unsafe fn unchecked_new(val: T) -> Self

👎Deprecated since 2.5.0: Please use the new_unchecked function instead.

Create a NotNan value from a value that is guaranteed to not be NaN

§Safety

Behaviour is undefined if val is NaN

source§

impl NotNan<f64>

source

pub fn as_f32(self) -> NotNan<f32>

Converts this NotNan<f64> to a NotNan<f32> while giving up on precision, using roundTiesToEven as rounding mode, yielding Infinity on overflow.

Note: For the reverse conversion (from NotNan<f32> to NotNan<f64>), you can use .into().

Trait Implementations§

source§

impl<T: FloatCore> Add<&NotNan<T>> for NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the + operator.
source§

fn add(self, other: &Self) -> Self::Output

Performs the + operation. Read more
source§

impl<T: FloatCore> Add<&T> for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the + operator.
source§

fn add(self, other: &T) -> Self::Output

Performs the + operation. Read more
source§

impl<T: FloatCore> Add<&T> for NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the + operator.
source§

fn add(self, other: &T) -> Self::Output

Performs the + operation. Read more
source§

impl<T: FloatCore> Add<NotNan<T>> for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the + operator.
source§

fn add(self, other: NotNan<T>) -> Self::Output

Performs the + operation. Read more
source§

impl<T: FloatCore> Add<T> for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the + operator.
source§

fn add(self, other: T) -> Self::Output

Performs the + operation. Read more
source§

impl<T: FloatCore> Add<T> for NotNan<T>

Adds a float directly.

Panics if the provided value is NaN or the computation results in NaN

source§

type Output = NotNan<T>

The resulting type after applying the + operator.
source§

fn add(self, other: T) -> Self

Performs the + operation. Read more
source§

impl<T: FloatCore> Add for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the + operator.
source§

fn add(self, other: Self) -> Self::Output

Performs the + operation. Read more
source§

impl<T: FloatCore> Add for NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the + operator.
source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
source§

impl<T: FloatCore + AddAssign> AddAssign<&NotNan<T>> for NotNan<T>

source§

fn add_assign(&mut self, other: &Self)

Performs the += operation. Read more
source§

impl<T: FloatCore + AddAssign> AddAssign<&T> for NotNan<T>

source§

fn add_assign(&mut self, other: &T)

Performs the += operation. Read more
source§

impl<T: FloatCore + AddAssign> AddAssign<T> for NotNan<T>

source§

fn add_assign(&mut self, other: T)

Performs the += operation. Read more
source§

impl<T: FloatCore + AddAssign> AddAssign for NotNan<T>

source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
source§

impl AsPrimitive<NotNan<f32>> for NotNan<f32>

source§

fn as_(self) -> NotNan<f32>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f32>> for NotNan<f64>

source§

fn as_(self) -> NotNan<f32>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f32>> for i16

source§

fn as_(self) -> NotNan<f32>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f32>> for i32

source§

fn as_(self) -> NotNan<f32>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f32>> for i64

source§

fn as_(self) -> NotNan<f32>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f32>> for i8

source§

fn as_(self) -> NotNan<f32>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f32>> for isize

source§

fn as_(self) -> NotNan<f32>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f32>> for u16

source§

fn as_(self) -> NotNan<f32>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f32>> for u32

source§

fn as_(self) -> NotNan<f32>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f32>> for u64

source§

fn as_(self) -> NotNan<f32>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f32>> for u8

source§

fn as_(self) -> NotNan<f32>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f32>> for usize

source§

fn as_(self) -> NotNan<f32>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f64>> for NotNan<f32>

source§

fn as_(self) -> NotNan<f64>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f64>> for NotNan<f64>

source§

fn as_(self) -> NotNan<f64>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f64>> for i16

source§

fn as_(self) -> NotNan<f64>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f64>> for i32

source§

fn as_(self) -> NotNan<f64>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f64>> for i64

source§

fn as_(self) -> NotNan<f64>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f64>> for i8

source§

fn as_(self) -> NotNan<f64>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f64>> for isize

source§

fn as_(self) -> NotNan<f64>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f64>> for u16

source§

fn as_(self) -> NotNan<f64>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f64>> for u32

source§

fn as_(self) -> NotNan<f64>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f64>> for u64

source§

fn as_(self) -> NotNan<f64>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f64>> for u8

source§

fn as_(self) -> NotNan<f64>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<NotNan<f64>> for usize

source§

fn as_(self) -> NotNan<f64>

Convert a value to another, using the as operator.
source§

impl AsPrimitive<f32> for NotNan<f32>

source§

fn as_(self) -> f32

Convert a value to another, using the as operator.
source§

impl AsPrimitive<f32> for NotNan<f64>

source§

fn as_(self) -> f32

Convert a value to another, using the as operator.
source§

impl AsPrimitive<f64> for NotNan<f32>

source§

fn as_(self) -> f64

Convert a value to another, using the as operator.
source§

impl AsPrimitive<f64> for NotNan<f64>

source§

fn as_(self) -> f64

Convert a value to another, using the as operator.
source§

impl AsPrimitive<i16> for NotNan<f32>

source§

fn as_(self) -> i16

Convert a value to another, using the as operator.
source§

impl AsPrimitive<i16> for NotNan<f64>

source§

fn as_(self) -> i16

Convert a value to another, using the as operator.
source§

impl AsPrimitive<i32> for NotNan<f32>

source§

fn as_(self) -> i32

Convert a value to another, using the as operator.
source§

impl AsPrimitive<i32> for NotNan<f64>

source§

fn as_(self) -> i32

Convert a value to another, using the as operator.
source§

impl AsPrimitive<i64> for NotNan<f32>

source§

fn as_(self) -> i64

Convert a value to another, using the as operator.
source§

impl AsPrimitive<i64> for NotNan<f64>

source§

fn as_(self) -> i64

Convert a value to another, using the as operator.
source§

impl AsPrimitive<i8> for NotNan<f32>

source§

fn as_(self) -> i8

Convert a value to another, using the as operator.
source§

impl AsPrimitive<i8> for NotNan<f64>

source§

fn as_(self) -> i8

Convert a value to another, using the as operator.
source§

impl AsPrimitive<isize> for NotNan<f32>

source§

fn as_(self) -> isize

Convert a value to another, using the as operator.
source§

impl AsPrimitive<isize> for NotNan<f64>

source§

fn as_(self) -> isize

Convert a value to another, using the as operator.
source§

impl AsPrimitive<u16> for NotNan<f32>

source§

fn as_(self) -> u16

Convert a value to another, using the as operator.
source§

impl AsPrimitive<u16> for NotNan<f64>

source§

fn as_(self) -> u16

Convert a value to another, using the as operator.
source§

impl AsPrimitive<u32> for NotNan<f32>

source§

fn as_(self) -> u32

Convert a value to another, using the as operator.
source§

impl AsPrimitive<u32> for NotNan<f64>

source§

fn as_(self) -> u32

Convert a value to another, using the as operator.
source§

impl AsPrimitive<u64> for NotNan<f32>

source§

fn as_(self) -> u64

Convert a value to another, using the as operator.
source§

impl AsPrimitive<u64> for NotNan<f64>

source§

fn as_(self) -> u64

Convert a value to another, using the as operator.
source§

impl AsPrimitive<u8> for NotNan<f32>

source§

fn as_(self) -> u8

Convert a value to another, using the as operator.
source§

impl AsPrimitive<u8> for NotNan<f64>

source§

fn as_(self) -> u8

Convert a value to another, using the as operator.
source§

impl AsPrimitive<usize> for NotNan<f32>

source§

fn as_(self) -> usize

Convert a value to another, using the as operator.
source§

impl AsPrimitive<usize> for NotNan<f64>

source§

fn as_(self) -> usize

Convert a value to another, using the as operator.
source§

impl<T: FloatCore> AsRef<T> for NotNan<T>

source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Borrow<f32> for NotNan<f32>

source§

fn borrow(&self) -> &f32

Immutably borrows from an owned value. Read more
source§

impl Borrow<f64> for NotNan<f64>

source§

fn borrow(&self) -> &f64

Immutably borrows from an owned value. Read more
source§

impl<T: FloatCore> Bounded for NotNan<T>

source§

fn min_value() -> Self

Returns the smallest finite number this type can represent
source§

fn max_value() -> Self

Returns the largest finite number this type can represent
source§

impl<T: Clone> Clone for NotNan<T>

source§

fn clone(&self) -> NotNan<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for NotNan<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Default> Default for NotNan<T>

source§

fn default() -> NotNan<T>

Returns the “default value” for a type. Read more
source§

impl<T: FloatCore> Deref for NotNan<T>

source§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T: FloatCore + Display> Display for NotNan<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: FloatCore> Div<&NotNan<T>> for NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the / operator.
source§

fn div(self, other: &Self) -> Self::Output

Performs the / operation. Read more
source§

impl<T: FloatCore> Div<&T> for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the / operator.
source§

fn div(self, other: &T) -> Self::Output

Performs the / operation. Read more
source§

impl<T: FloatCore> Div<&T> for NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the / operator.
source§

fn div(self, other: &T) -> Self::Output

Performs the / operation. Read more
source§

impl<T: FloatCore> Div<NotNan<T>> for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the / operator.
source§

fn div(self, other: NotNan<T>) -> Self::Output

Performs the / operation. Read more
source§

impl<T: FloatCore> Div<T> for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the / operator.
source§

fn div(self, other: T) -> Self::Output

Performs the / operation. Read more
source§

impl<T: FloatCore> Div<T> for NotNan<T>

Divides a float directly.

Panics if the provided value is NaN or the computation results in NaN

source§

type Output = NotNan<T>

The resulting type after applying the / operator.
source§

fn div(self, other: T) -> Self

Performs the / operation. Read more
source§

impl<T: FloatCore> Div for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the / operator.
source§

fn div(self, other: Self) -> Self::Output

Performs the / operation. Read more
source§

impl<T: FloatCore> Div for NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the / operator.
source§

fn div(self, other: Self) -> Self

Performs the / operation. Read more
source§

impl<T: FloatCore + DivAssign> DivAssign<&NotNan<T>> for NotNan<T>

source§

fn div_assign(&mut self, other: &Self)

Performs the /= operation. Read more
source§

impl<T: FloatCore + DivAssign> DivAssign<&T> for NotNan<T>

source§

fn div_assign(&mut self, other: &T)

Performs the /= operation. Read more
source§

impl<T: FloatCore + DivAssign> DivAssign<T> for NotNan<T>

source§

fn div_assign(&mut self, other: T)

Performs the /= operation. Read more
source§

impl<T: FloatCore + DivAssign> DivAssign for NotNan<T>

source§

fn div_assign(&mut self, other: Self)

Performs the /= operation. Read more
source§

impl<T: FloatConst> FloatConst for NotNan<T>

source§

fn E() -> Self

Return Euler’s number.
source§

fn FRAC_1_PI() -> Self

Return 1.0 / π.
source§

fn FRAC_1_SQRT_2() -> Self

Return 1.0 / sqrt(2.0).
source§

fn FRAC_2_PI() -> Self

Return 2.0 / π.
source§

fn FRAC_2_SQRT_PI() -> Self

Return 2.0 / sqrt(π).
source§

fn FRAC_PI_2() -> Self

Return π / 2.0.
source§

fn FRAC_PI_3() -> Self

Return π / 3.0.
source§

fn FRAC_PI_4() -> Self

Return π / 4.0.
source§

fn FRAC_PI_6() -> Self

Return π / 6.0.
source§

fn FRAC_PI_8() -> Self

Return π / 8.0.
source§

fn LN_10() -> Self

Return ln(10.0).
source§

fn LN_2() -> Self

Return ln(2.0).
source§

fn LOG10_E() -> Self

Return log10(e).
source§

fn LOG2_E() -> Self

Return log2(e).
source§

fn PI() -> Self

Return Archimedes’ constant π.
source§

fn SQRT_2() -> Self

Return sqrt(2.0).
source§

impl From<NotNan<f32>> for NotNan<f64>

source§

fn from(v: NotNan<f32>) -> NotNan<f64>

Converts to this type from the input type.
source§

impl From<NotNan<f32>> for f32

source§

fn from(value: NotNan<f32>) -> Self

Converts to this type from the input type.
source§

impl From<NotNan<f64>> for f64

source§

fn from(value: NotNan<f64>) -> Self

Converts to this type from the input type.
source§

impl From<i16> for NotNan<f32>

source§

fn from(source: i16) -> Self

Converts to this type from the input type.
source§

impl From<i16> for NotNan<f64>

source§

fn from(source: i16) -> Self

Converts to this type from the input type.
source§

impl From<i32> for NotNan<f64>

source§

fn from(source: i32) -> Self

Converts to this type from the input type.
source§

impl From<i8> for NotNan<f32>

source§

fn from(source: i8) -> Self

Converts to this type from the input type.
source§

impl From<i8> for NotNan<f64>

source§

fn from(source: i8) -> Self

Converts to this type from the input type.
source§

impl From<u16> for NotNan<f32>

source§

fn from(source: u16) -> Self

Converts to this type from the input type.
source§

impl From<u16> for NotNan<f64>

source§

fn from(source: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for NotNan<f64>

source§

fn from(source: u32) -> Self

Converts to this type from the input type.
source§

impl From<u8> for NotNan<f32>

source§

fn from(source: u8) -> Self

Converts to this type from the input type.
source§

impl From<u8> for NotNan<f64>

source§

fn from(source: u8) -> Self

Converts to this type from the input type.
source§

impl<T: FloatCore + FromPrimitive> FromPrimitive for NotNan<T>

source§

fn from_i64(n: i64) -> Option<Self>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_u64(n: u64) -> Option<Self>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_f32(n: f32) -> Option<Self>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
source§

fn from_f64(n: f64) -> Option<Self>

Converts a f64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
source§

fn from_i128(n: i128) -> Option<Self>

Converts an i128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
source§

fn from_u128(n: u128) -> Option<Self>

Converts an u128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
source§

impl<T: FloatCore + FromStr> FromStr for NotNan<T>

source§

fn from_str(src: &str) -> Result<Self, Self::Err>

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());
source§

type Err = ParseNotNanError<<T as FromStr>::Err>

The associated error which can be returned from parsing.
source§

impl<T: FloatCore> Hash for NotNan<T>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T: FloatCore> Mul<&NotNan<T>> for NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: &Self) -> Self::Output

Performs the * operation. Read more
source§

impl<T: FloatCore> Mul<&T> for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: &T) -> Self::Output

Performs the * operation. Read more
source§

impl<T: FloatCore> Mul<&T> for NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: &T) -> Self::Output

Performs the * operation. Read more
source§

impl<T: FloatCore> Mul<NotNan<T>> for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: NotNan<T>) -> Self::Output

Performs the * operation. Read more
source§

impl<T: FloatCore> Mul<T> for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: T) -> Self::Output

Performs the * operation. Read more
source§

impl<T: FloatCore> Mul<T> for NotNan<T>

Multiplies a float directly.

Panics if the provided value is NaN or the computation results in NaN

source§

type Output = NotNan<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: T) -> Self

Performs the * operation. Read more
source§

impl<T: FloatCore> Mul for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: Self) -> Self::Output

Performs the * operation. Read more
source§

impl<T: FloatCore> Mul for NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the * operator.
source§

fn mul(self, other: Self) -> Self

Performs the * operation. Read more
source§

impl<T: FloatCore + MulAssign> MulAssign<&NotNan<T>> for NotNan<T>

source§

fn mul_assign(&mut self, other: &Self)

Performs the *= operation. Read more
source§

impl<T: FloatCore + MulAssign> MulAssign<&T> for NotNan<T>

source§

fn mul_assign(&mut self, other: &T)

Performs the *= operation. Read more
source§

impl<T: FloatCore + MulAssign> MulAssign<T> for NotNan<T>

source§

fn mul_assign(&mut self, other: T)

Performs the *= operation. Read more
source§

impl<T: FloatCore + MulAssign> MulAssign for NotNan<T>

source§

fn mul_assign(&mut self, other: Self)

Performs the *= operation. Read more
source§

impl<T: FloatCore> Neg for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl<T: FloatCore> Neg for NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl<T: FloatCore> Num for NotNan<T>

source§

type FromStrRadixErr = ParseNotNanError<<T as Num>::FromStrRadixErr>

source§

fn from_str_radix(src: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>

Convert from a string and radix (typically 2..=36). Read more
source§

impl<T: FloatCore> NumCast for NotNan<T>

source§

fn from<F: ToPrimitive>(n: F) -> Option<Self>

Creates a number from another value that can be converted into a primitive via the ToPrimitive trait. If the source value cannot be represented by the target type, then None is returned. Read more
source§

impl<T: FloatCore> One for NotNan<T>

source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
source§

fn is_one(&self) -> bool
where Self: PartialEq,

Returns true if self is equal to the multiplicative identity. Read more
source§

impl<T: FloatCore> Ord for NotNan<T>

source§

fn cmp(&self, other: &NotNan<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
source§

impl<T: FloatCore> PartialEq<T> for NotNan<T>

source§

fn eq(&self, other: &T) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: PartialEq> PartialEq for NotNan<T>

source§

fn eq(&self, other: &NotNan<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: PartialOrd> PartialOrd for NotNan<T>

source§

fn partial_cmp(&self, other: &NotNan<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a, 'b> Pow<&'a NotNan<f32>> for &'b NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: &'a NotNan<f32>) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a, 'b> Pow<&'a NotNan<f32>> for &'b NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: &'a NotNan<f32>) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<&'a NotNan<f32>> for NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: &'a NotNan<f32>) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<&'a NotNan<f32>> for NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: &'a NotNan<f32>) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a, 'b> Pow<&'a NotNan<f64>> for &'b NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: &'a NotNan<f64>) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<&'a NotNan<f64>> for NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: &'a NotNan<f64>) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a, 'b> Pow<&'a f32> for &'b NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: &'a f32) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a, 'b> Pow<&'a f32> for &'b NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: &'a f32) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<&'a f32> for NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: &'a f32) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<&'a f32> for NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: &'a f32) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a, 'b> Pow<&'a f64> for &'b NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: &'a f64) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<&'a f64> for NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: &'a f64) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a, 'b> Pow<&'a i16> for &'b NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: &'a i16) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a, 'b> Pow<&'a i16> for &'b NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: &'a i16) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<&'a i16> for NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: &'a i16) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<&'a i16> for NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: &'a i16) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a, 'b> Pow<&'a i32> for &'b NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: &'a i32) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a, 'b> Pow<&'a i32> for &'b NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: &'a i32) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<&'a i32> for NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: &'a i32) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<&'a i32> for NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: &'a i32) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a, 'b> Pow<&'a i8> for &'b NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: &'a i8) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a, 'b> Pow<&'a i8> for &'b NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: &'a i8) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<&'a i8> for NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: &'a i8) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<&'a i8> for NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: &'a i8) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a, 'b> Pow<&'a u16> for &'b NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: &'a u16) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a, 'b> Pow<&'a u16> for &'b NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: &'a u16) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<&'a u16> for NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: &'a u16) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<&'a u16> for NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: &'a u16) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a, 'b> Pow<&'a u8> for &'b NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: &'a u8) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a, 'b> Pow<&'a u8> for &'b NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: &'a u8) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<&'a u8> for NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: &'a u8) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<&'a u8> for NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: &'a u8) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<NotNan<f32>> for &'a NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: NotNan<f32>) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<NotNan<f32>> for &'a NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: NotNan<f32>) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl Pow<NotNan<f32>> for NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: NotNan<f32>) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl Pow<NotNan<f32>> for NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: NotNan<f32>) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<NotNan<f64>> for &'a NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: NotNan<f64>) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl Pow<NotNan<f64>> for NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: NotNan<f64>) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<f32> for &'a NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: f32) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<f32> for &'a NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: f32) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl Pow<f32> for NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: f32) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl Pow<f32> for NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: f32) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<f64> for &'a NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: f64) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl Pow<f64> for NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: f64) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<i16> for &'a NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: i16) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<i16> for &'a NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: i16) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl Pow<i16> for NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: i16) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl Pow<i16> for NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: i16) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<i32> for &'a NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: i32) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<i32> for &'a NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: i32) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl Pow<i32> for NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: i32) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl Pow<i32> for NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: i32) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<i8> for &'a NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: i8) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<i8> for &'a NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: i8) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl Pow<i8> for NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: i8) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl Pow<i8> for NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: i8) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<u16> for &'a NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: u16) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<u16> for &'a NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: u16) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl Pow<u16> for NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: u16) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl Pow<u16> for NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: u16) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<u8> for &'a NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: u8) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl<'a> Pow<u8> for &'a NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: u8) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl Pow<u8> for NotNan<f32>

source§

type Output = NotNan<f32>

The result after applying the operator.
source§

fn pow(self, rhs: u8) -> NotNan<f32>

Returns self to the power rhs. Read more
source§

impl Pow<u8> for NotNan<f64>

source§

type Output = NotNan<f64>

The result after applying the operator.
source§

fn pow(self, rhs: u8) -> NotNan<f64>

Returns self to the power rhs. Read more
source§

impl<'a, T: FloatCore + Product + 'a> Product<&'a NotNan<T>> for NotNan<T>

source§

fn product<I: Iterator<Item = &'a NotNan<T>>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
source§

impl<T: FloatCore + Product> Product for NotNan<T>

source§

fn product<I: Iterator<Item = NotNan<T>>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
source§

impl<T: FloatCore> Rem<&NotNan<T>> for NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the % operator.
source§

fn rem(self, other: &Self) -> Self::Output

Performs the % operation. Read more
source§

impl<T: FloatCore> Rem<&T> for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the % operator.
source§

fn rem(self, other: &T) -> Self::Output

Performs the % operation. Read more
source§

impl<T: FloatCore> Rem<&T> for NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the % operator.
source§

fn rem(self, other: &T) -> Self::Output

Performs the % operation. Read more
source§

impl<T: FloatCore> Rem<NotNan<T>> for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the % operator.
source§

fn rem(self, other: NotNan<T>) -> Self::Output

Performs the % operation. Read more
source§

impl<T: FloatCore> Rem<T> for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the % operator.
source§

fn rem(self, other: T) -> Self::Output

Performs the % operation. Read more
source§

impl<T: FloatCore> Rem<T> for NotNan<T>

Calculates % with a float directly.

Panics if the provided value is NaN or the computation results in NaN

source§

type Output = NotNan<T>

The resulting type after applying the % operator.
source§

fn rem(self, other: T) -> Self

Performs the % operation. Read more
source§

impl<T: FloatCore> Rem for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the % operator.
source§

fn rem(self, other: Self) -> Self::Output

Performs the % operation. Read more
source§

impl<T: FloatCore> Rem for NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the % operator.
source§

fn rem(self, other: Self) -> Self

Performs the % operation. Read more
source§

impl<T: FloatCore + RemAssign> RemAssign<&NotNan<T>> for NotNan<T>

source§

fn rem_assign(&mut self, other: &Self)

Performs the %= operation. Read more
source§

impl<T: FloatCore + RemAssign> RemAssign<&T> for NotNan<T>

source§

fn rem_assign(&mut self, other: &T)

Performs the %= operation. Read more
source§

impl<T: FloatCore + RemAssign> RemAssign<T> for NotNan<T>

source§

fn rem_assign(&mut self, other: T)

Performs the %= operation. Read more
source§

impl<T: FloatCore + RemAssign> RemAssign for NotNan<T>

source§

fn rem_assign(&mut self, other: Self)

Performs the %= operation. Read more
source§

impl<T: FloatCore + Signed> Signed for NotNan<T>

source§

fn abs(&self) -> Self

Computes the absolute value. Read more
source§

fn abs_sub(&self, other: &Self) -> Self

The positive difference of two numbers. Read more
source§

fn signum(&self) -> Self

Returns the sign of the number. Read more
source§

fn is_positive(&self) -> bool

Returns true if the number is positive and false if the number is zero or negative.
source§

fn is_negative(&self) -> bool

Returns true if the number is negative and false if the number is zero or positive.
source§

impl<T: FloatCore> Sub<&NotNan<T>> for NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: &Self) -> Self::Output

Performs the - operation. Read more
source§

impl<T: FloatCore> Sub<&T> for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: &T) -> Self::Output

Performs the - operation. Read more
source§

impl<T: FloatCore> Sub<&T> for NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: &T) -> Self::Output

Performs the - operation. Read more
source§

impl<T: FloatCore> Sub<NotNan<T>> for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: NotNan<T>) -> Self::Output

Performs the - operation. Read more
source§

impl<T: FloatCore> Sub<T> for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: T) -> Self::Output

Performs the - operation. Read more
source§

impl<T: FloatCore> Sub<T> for NotNan<T>

Subtracts a float directly.

Panics if the provided value is NaN or the computation results in NaN

source§

type Output = NotNan<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: T) -> Self

Performs the - operation. Read more
source§

impl<T: FloatCore> Sub for &NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: Self) -> Self::Output

Performs the - operation. Read more
source§

impl<T: FloatCore> Sub for NotNan<T>

source§

type Output = NotNan<T>

The resulting type after applying the - operator.
source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more
source§

impl<T: FloatCore + SubAssign> SubAssign<&NotNan<T>> for NotNan<T>

source§

fn sub_assign(&mut self, other: &Self)

Performs the -= operation. Read more
source§

impl<T: FloatCore + SubAssign> SubAssign<&T> for NotNan<T>

source§

fn sub_assign(&mut self, other: &T)

Performs the -= operation. Read more
source§

impl<T: FloatCore + SubAssign> SubAssign<T> for NotNan<T>

source§

fn sub_assign(&mut self, other: T)

Performs the -= operation. Read more
source§

impl<T: FloatCore + SubAssign> SubAssign for NotNan<T>

source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
source§

impl<'a, T: FloatCore + Sum + 'a> Sum<&'a NotNan<T>> for NotNan<T>

source§

fn sum<I: Iterator<Item = &'a NotNan<T>>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl<T: FloatCore + Sum> Sum for NotNan<T>

Adds a float directly.

Panics if the provided value is NaN.

source§

fn sum<I: Iterator<Item = NotNan<T>>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl<T: FloatCore> ToPrimitive for NotNan<T>

source§

fn to_i64(&self) -> Option<i64>

Converts the value of self to an i64. If the value cannot be represented by an i64, then None is returned.
source§

fn to_u64(&self) -> Option<u64>

Converts the value of self to a u64. If the value cannot be represented by a u64, then None is returned.
source§

fn to_isize(&self) -> Option<isize>

Converts the value of self to an isize. If the value cannot be represented by an isize, then None is returned.
source§

fn to_i8(&self) -> Option<i8>

Converts the value of self to an i8. If the value cannot be represented by an i8, then None is returned.
source§

fn to_i16(&self) -> Option<i16>

Converts the value of self to an i16. If the value cannot be represented by an i16, then None is returned.
source§

fn to_i32(&self) -> Option<i32>

Converts the value of self to an i32. If the value cannot be represented by an i32, then None is returned.
source§

fn to_usize(&self) -> Option<usize>

Converts the value of self to a usize. If the value cannot be represented by a usize, then None is returned.
source§

fn to_u8(&self) -> Option<u8>

Converts the value of self to a u8. If the value cannot be represented by a u8, then None is returned.
source§

fn to_u16(&self) -> Option<u16>

Converts the value of self to a u16. If the value cannot be represented by a u16, then None is returned.
source§

fn to_u32(&self) -> Option<u32>

Converts the value of self to a u32. If the value cannot be represented by a u32, then None is returned.
source§

fn to_f32(&self) -> Option<f32>

Converts the value of self to an f32. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f32.
source§

fn to_f64(&self) -> Option<f64>

Converts the value of self to an f64. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f64. Read more
source§

fn to_i128(&self) -> Option<i128>

Converts the value of self to an i128. If the value cannot be represented by an i128 (i64 under the default implementation), then None is returned. Read more
source§

fn to_u128(&self) -> Option<u128>

Converts the value of self to a u128. If the value cannot be represented by a u128 (u64 under the default implementation), then None is returned. Read more
source§

impl TryFrom<f32> for NotNan<f32>

source§

type Error = FloatIsNan

The type returned in the event of a conversion error.
source§

fn try_from(v: f32) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<f64> for NotNan<f64>

source§

type Error = FloatIsNan

The type returned in the event of a conversion error.
source§

fn try_from(v: f64) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T: FloatCore> Zero for NotNan<T>

source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
source§

impl<T: Copy> Copy for NotNan<T>

source§

impl<T: FloatCore + PartialEq> Eq for NotNan<T>

source§

impl<T> StructuralPartialEq for NotNan<T>

Auto Trait Implementations§

§

impl<T> Freeze for NotNan<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for NotNan<T>
where T: RefUnwindSafe,

§

impl<T> Send for NotNan<T>
where T: Send,

§

impl<T> Sync for NotNan<T>
where T: Sync,

§

impl<T> Unpin for NotNan<T>
where T: Unpin,

§

impl<T> UnwindSafe for NotNan<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> LowerBounded for T
where T: Bounded,

source§

fn min_value() -> T

Returns the smallest finite number this type can represent
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UpperBounded for T
where T: Bounded,

source§

fn max_value() -> T

Returns the largest finite number this type can represent
source§

impl<T> NumAssign for T
where T: Num + NumAssignOps,

source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

source§

impl<T> NumAssignRef for T
where T: NumAssign + for<'r> NumAssignOps<&'r T>,

source§

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>,

source§

impl<T> NumRef for T
where T: Num + for<'r> NumOps<&'r T>,

source§

impl<T, Base> RefNum<Base> for T
where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,