Struct otter_api_tests::imports::ordered_float::NotNan[]

#[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>

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

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

Safety

Behaviour is undefined if val is NaN

impl<T> NotNan<T> where
    T: Float

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

Create a NotNan value.

Returns Err if val is NaN

pub fn into_inner(self) -> T

Get the value out.

Trait Implementations

impl<T> Add<NotNan<T>> for NotNan<T> where
    T: Float

Adds two NotNans.

Panics if the computation results in NaN

type Output = NotNan<T>

The resulting type after applying the + operator.

impl<T> Add<T> for NotNan<T> where
    T: Float

Adds a float directly.

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

type Output = NotNan<T>

The resulting type after applying the + operator.

impl<T> AddAssign<NotNan<T>> for NotNan<T> where
    T: Float + AddAssign<T>, 

impl<T> AddAssign<T> for NotNan<T> where
    T: Float + AddAssign<T>, 

Adds a float directly.

Panics if the provided value is NaN.

impl<T> AsRef<T> for NotNan<T> where
    T: Float

impl<T> Bounded for NotNan<T> where
    T: Float

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

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

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

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

impl<T> Deref for NotNan<T> where
    T: Float

type Target = T

The resulting type after dereferencing.

impl<T> Display for NotNan<T> where
    T: Float + Display

impl<T> Div<NotNan<T>> for NotNan<T> where
    T: Float

type Output = NotNan<T>

The resulting type after applying the / operator.

impl<T> Div<T> for NotNan<T> where
    T: Float

Divides a float directly.

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

type Output = NotNan<T>

The resulting type after applying the / operator.

impl<T> DivAssign<NotNan<T>> for NotNan<T> where
    T: Float + DivAssign<T>, 

impl<T> DivAssign<T> for NotNan<T> where
    T: Float + DivAssign<T>, 

Divides a float directly.

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

impl<T> Eq for NotNan<T> where
    T: Float + PartialEq<T>, 

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

impl From<NotNan<f32>> for f32

impl From<NotNan<f64>> for f64

impl<T> FromPrimitive for NotNan<T> where
    T: Float + FromPrimitive

impl<T> FromStr for NotNan<T> where
    T: Float + FromStr

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

The associated error which can be returned from parsing.

pub fn from_str(src: &str) -> Result<NotNan<T>, <NotNan<T> as FromStr>::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());

impl<T> Hash for NotNan<T> where
    T: Float

impl<T> Mul<NotNan<T>> for NotNan<T> where
    T: Float

type Output = NotNan<T>

The resulting type after applying the * operator.

impl<T> Mul<T> for NotNan<T> where
    T: Float

Multiplies a float directly.

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

type Output = NotNan<T>

The resulting type after applying the * operator.

impl<T> MulAssign<NotNan<T>> for NotNan<T> where
    T: Float + MulAssign<T>, 

impl<T> MulAssign<T> for NotNan<T> where
    T: Float + MulAssign<T>, 

Multiplies a float directly.

Panics if the provided value is NaN.

impl<T> Neg for NotNan<T> where
    T: Float

type Output = NotNan<T>

The resulting type after applying the - operator.

impl<T> Num for NotNan<T> where
    T: Float

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

impl<T> NumCast for NotNan<T> where
    T: Float

impl<T> One for NotNan<T> where
    T: Float

impl<T> Ord for NotNan<T> where
    T: Float

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

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

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

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

impl<T> Product<NotNan<T>> for NotNan<T> where
    T: Float + Product<T>, 

impl<T> Rem<NotNan<T>> for NotNan<T> where
    T: Float

type Output = NotNan<T>

The resulting type after applying the % operator.

impl<T> Rem<T> for NotNan<T> where
    T: Float

Calculates % with a float directly.

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

type Output = NotNan<T>

The resulting type after applying the % operator.

impl<T> RemAssign<NotNan<T>> for NotNan<T> where
    T: Float + RemAssign<T>, 

impl<T> RemAssign<T> for NotNan<T> where
    T: Float + RemAssign<T>, 

Calculates %= with a float directly.

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

impl<T> Signed for NotNan<T> where
    T: Float + Signed

impl<T> StructuralPartialEq for NotNan<T>

impl<T> Sub<NotNan<T>> for NotNan<T> where
    T: Float

type Output = NotNan<T>

The resulting type after applying the - operator.

impl<T> Sub<T> for NotNan<T> where
    T: Float

Subtracts a float directly.

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

type Output = NotNan<T>

The resulting type after applying the - operator.

impl<T> SubAssign<NotNan<T>> for NotNan<T> where
    T: Float + SubAssign<T>, 

impl<T> SubAssign<T> for NotNan<T> where
    T: Float + SubAssign<T>, 

Subtracts a float directly.

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

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

impl<T> Sum<NotNan<T>> for NotNan<T> where
    T: Float + Sum<T>, 

impl<T> ToPrimitive for NotNan<T> where
    T: Float

impl TryFrom<f32> for NotNan<f32>

type Error = FloatIsNan

The type returned in the event of a conversion error.

impl TryFrom<f64> for NotNan<f64>

type Error = FloatIsNan

The type returned in the event of a conversion error.

impl<T> Zero for NotNan<T> where
    T: Float

Auto Trait Implementations

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Any + Send + Sync

impl<A> DynCastExt for A

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<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, 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> OrdExt<T> for T where
    T: Ord + Clone
[src]

impl<T> RuleType for T where
    T: Copy + Debug + Eq + Hash + Ord
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,