Struct ordered_float::NotNaN [] [src]

pub struct NotNaN<T: Float>(_);

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]

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

Create a NotNaN value.

Returns Err if val is NaN

unsafe fn unchecked_new(val: T) -> Self

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

Behaviour is undefined if val is NaN

fn into_inner(self) -> T

Get the value out.

Trait Implementations

impl<T: Copy + Float> Copy for NotNaN<T>
[src]

impl<T: Clone + Float> Clone for NotNaN<T>
[src]

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

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl<T: Default + Float> Default for NotNaN<T>
[src]

fn default() -> NotNaN<T>

Returns the "default value" for a type. Read more

impl<T: Debug + Float> Debug for NotNaN<T>
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<T: PartialEq + Float> PartialEq for NotNaN<T>
[src]

fn eq(&self, __arg_0: &NotNaN<T>) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &NotNaN<T>) -> bool

This method tests for !=.

impl<T: PartialOrd + Float> PartialOrd for NotNaN<T>
[src]

fn partial_cmp(&self, __arg_0: &NotNaN<T>) -> Option<Ordering>

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

fn lt(&self, __arg_0: &NotNaN<T>) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more

fn le(&self, __arg_0: &NotNaN<T>) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

fn gt(&self, __arg_0: &NotNaN<T>) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more

fn ge(&self, __arg_0: &NotNaN<T>) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<T: Float> AsRef<T> for NotNaN<T>
[src]

fn as_ref(&self) -> &T

Performs the conversion.

impl<T: Float + PartialOrd> Ord for NotNaN<T>
[src]

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

This method returns an Ordering between self and other. Read more

impl<T: Float> Hash for NotNaN<T>
[src]

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

Feeds this value into the state given, updating the hasher as necessary.

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

Feeds a slice of this type into the state provided.

impl<T: Float + Display> Display for NotNaN<T>
[src]

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

Formats the value using the given formatter.

impl Into<f32> for NotNaN<f32>
[src]

fn into(self) -> f32

Performs the conversion.

impl Into<f64> for NotNaN<f64>
[src]

fn into(self) -> f64

Performs the conversion.

impl<T: Float> From<T> for NotNaN<T>
[src]

Creates a NotNaN value from a Float.

Panics if the provided value is NaN.

fn from(v: T) -> Self

Performs the conversion.

impl<T: Float> Deref for NotNaN<T>
[src]

type Target = T

The resulting type after dereferencing

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

The method called to dereference a value

impl<T: Float + PartialEq> Eq for NotNaN<T>
[src]

impl<T: Float> Add for NotNaN<T>
[src]

type Output = Self

The resulting type after applying the + operator

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

The method for the + operator

impl<T: Float> Add<T> for NotNaN<T>
[src]

Adds a float directly.

Panics if the provided value is NaN.

type Output = Self

The resulting type after applying the + operator

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

The method for the + operator

impl AddAssign for NotNaN<f64>
[src]

fn add_assign(&mut self, other: Self)

The method for the += operator

impl AddAssign for NotNaN<f32>
[src]

fn add_assign(&mut self, other: Self)

The method for the += operator

impl AddAssign<f64> for NotNaN<f64>
[src]

Adds a float directly.

Panics if the provided value is NaN.

fn add_assign(&mut self, other: f64)

The method for the += operator

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)

The method for the += operator

impl<T: Float> Sub for NotNaN<T>
[src]

type Output = Self

The resulting type after applying the - operator

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

The method for the - operator

impl<T: Float> Sub<T> for NotNaN<T>
[src]

Subtracts a float directly.

Panics if the provided value is NaN.

type Output = Self

The resulting type after applying the - operator

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

The method for the - operator

impl SubAssign for NotNaN<f64>
[src]

fn sub_assign(&mut self, other: Self)

The method for the -= operator

impl SubAssign for NotNaN<f32>
[src]

fn sub_assign(&mut self, other: Self)

The method for the -= operator

impl SubAssign<f64> for NotNaN<f64>
[src]

Subtracts a float directly.

Panics if the provided value is NaN.

fn sub_assign(&mut self, other: f64)

The method for the -= operator

impl SubAssign<f32> for NotNaN<f32>
[src]

Subtracts a float directly.

Panics if the provided value is NaN.

fn sub_assign(&mut self, other: f32)

The method for the -= operator

impl<T: Float> Mul for NotNaN<T>
[src]

type Output = Self

The resulting type after applying the * operator

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

The method for the * operator

impl<T: Float> Mul<T> for NotNaN<T>
[src]

Multiplies a float directly.

Panics if the provided value is NaN.

type Output = Self

The resulting type after applying the * operator

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

The method for the * operator

impl MulAssign for NotNaN<f64>
[src]

fn mul_assign(&mut self, other: Self)

The method for the *= operator

impl MulAssign for NotNaN<f32>
[src]

fn mul_assign(&mut self, other: Self)

The method for the *= operator

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)

The method for the *= operator

impl MulAssign<f32> for NotNaN<f32>
[src]

Multiplies a float directly.

Panics if the provided value is NaN.

fn mul_assign(&mut self, other: f32)

The method for the *= operator

impl<T: Float> Div for NotNaN<T>
[src]

type Output = Self

The resulting type after applying the / operator

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

The method for the / operator

impl<T: Float> Div<T> for NotNaN<T>
[src]

Divides a float directly.

Panics if the provided value is NaN.

type Output = Self

The resulting type after applying the / operator

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

The method for the / operator

impl DivAssign for NotNaN<f64>
[src]

fn div_assign(&mut self, other: Self)

The method for the /= operator

impl DivAssign for NotNaN<f32>
[src]

fn div_assign(&mut self, other: Self)

The method for the /= operator

impl DivAssign<f64> for NotNaN<f64>
[src]

Divides a float directly.

Panics if the provided value is NaN.

fn div_assign(&mut self, other: f64)

The method for the /= operator

impl DivAssign<f32> for NotNaN<f32>
[src]

Divides a float directly.

Panics if the provided value is NaN.

fn div_assign(&mut self, other: f32)

The method for the /= operator

impl<T: Float> Rem for NotNaN<T>
[src]

type Output = Self

The resulting type after applying the % operator

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

The method for the % operator

impl<T: Float> Rem<T> for NotNaN<T>
[src]

Calculates % with a float directly.

Panics if the provided value is NaN.

type Output = Self

The resulting type after applying the % operator

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

The method for the % operator

impl RemAssign for NotNaN<f64>
[src]

fn rem_assign(&mut self, other: Self)

The method for the %= operator

impl RemAssign for NotNaN<f32>
[src]

fn rem_assign(&mut self, other: Self)

The method for the %= operator

impl RemAssign<f64> for NotNaN<f64>
[src]

Calculates %= with a float directly.

Panics if the provided value is NaN.

fn rem_assign(&mut self, other: f64)

The method for the %= operator

impl RemAssign<f32> for NotNaN<f32>
[src]

Calculates %= with a float directly.

Panics if the provided value is NaN.

fn rem_assign(&mut self, other: f32)

The method for the %= operator

impl<T: Float> Neg for NotNaN<T>
[src]

type Output = Self

The resulting type after applying the - operator

fn neg(self) -> Self

The method for the unary - operator