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,
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,
T: Float,
Adds two NotNans.
Panics if the computation results in NaN
type Output = NotNan<T>
The resulting type after applying the +
operator.
pub fn add(self, other: NotNan<T>) -> NotNan<T>
impl<T> Add<T> for NotNan<T> where
T: Float,
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.
pub fn add(self, other: T) -> NotNan<T>
impl<T> AddAssign<NotNan<T>> for NotNan<T> where
T: Float + AddAssign<T>,
T: Float + AddAssign<T>,
pub fn add_assign(&mut self, other: NotNan<T>)
impl<T> AddAssign<T> for NotNan<T> where
T: Float + AddAssign<T>,
T: Float + AddAssign<T>,
Adds a float directly.
Panics if the provided value is NaN.
pub fn add_assign(&mut self, other: T)
impl<T> AsRef<T> for NotNan<T> where
T: Float,
T: Float,
pub fn as_ref(&self) -> &TⓘNotable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;
Notable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;
impl<T> Bounded for NotNan<T> where
T: Float,
T: Float,
impl<T> Clone for NotNan<T> where
T: Clone,
T: Clone,
pub fn clone(&self) -> NotNan<T>
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T> Copy for NotNan<T> where
T: Copy,
T: Copy,
impl<T> Debug for NotNan<T> where
T: Debug,
T: Debug,
impl<T> Default for NotNan<T> where
T: Default,
T: Default,
impl<T> Deref for NotNan<T> where
T: Float,
T: Float,
type Target = T
The resulting type after dereferencing.
pub fn deref(&self) -> &<NotNan<T> as Deref>::Target
impl<T> Display for NotNan<T> where
T: Float + Display,
T: Float + Display,
impl<T> Div<NotNan<T>> for NotNan<T> where
T: Float,
T: Float,
type Output = NotNan<T>
The resulting type after applying the /
operator.
pub fn div(self, other: NotNan<T>) -> NotNan<T>
impl<T> Div<T> for NotNan<T> where
T: Float,
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.
pub fn div(self, other: T) -> NotNan<T>
impl<T> DivAssign<NotNan<T>> for NotNan<T> where
T: Float + DivAssign<T>,
T: Float + DivAssign<T>,
pub fn div_assign(&mut self, other: NotNan<T>)
impl<T> DivAssign<T> for NotNan<T> where
T: Float + DivAssign<T>,
T: Float + DivAssign<T>,
Divides a float directly.
Panics if the provided value is NaN or the computation results in NaN
pub fn div_assign(&mut self, other: T)
impl<T> Eq for NotNan<T> where
T: Float + PartialEq<T>,
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,
T: Float + FromPrimitive,
pub fn from_i64(n: i64) -> Option<NotNan<T>>
pub fn from_u64(n: u64) -> Option<NotNan<T>>
pub fn from_isize(n: isize) -> Option<NotNan<T>>
pub fn from_i8(n: i8) -> Option<NotNan<T>>
pub fn from_i16(n: i16) -> Option<NotNan<T>>
pub fn from_i32(n: i32) -> Option<NotNan<T>>
pub fn from_usize(n: usize) -> Option<NotNan<T>>
pub fn from_u8(n: u8) -> Option<NotNan<T>>
pub fn from_u16(n: u16) -> Option<NotNan<T>>
pub fn from_u32(n: u32) -> Option<NotNan<T>>
pub fn from_f32(n: f32) -> Option<NotNan<T>>
pub fn from_f64(n: f64) -> Option<NotNan<T>>
pub fn from_i128(n: i128) -> Option<Self>
[src]
pub fn from_u128(n: u128) -> Option<Self>
[src]
impl<T> FromStr for NotNan<T> where
T: Float + FromStr,
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,
T: Float,
pub fn hash<H>(&self, state: &mut H) where
H: Hasher,
H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T> Mul<NotNan<T>> for NotNan<T> where
T: Float,
T: Float,
type Output = NotNan<T>
The resulting type after applying the *
operator.
pub fn mul(self, other: NotNan<T>) -> NotNan<T>
impl<T> Mul<T> for NotNan<T> where
T: Float,
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.
pub fn mul(self, other: T) -> NotNan<T>
impl<T> MulAssign<NotNan<T>> for NotNan<T> where
T: Float + MulAssign<T>,
T: Float + MulAssign<T>,
pub fn mul_assign(&mut self, other: NotNan<T>)
impl<T> MulAssign<T> for NotNan<T> where
T: Float + MulAssign<T>,
T: Float + MulAssign<T>,
Multiplies a float directly.
Panics if the provided value is NaN.
pub fn mul_assign(&mut self, other: T)
impl<T> Neg for NotNan<T> where
T: Float,
T: Float,
type Output = NotNan<T>
The resulting type after applying the -
operator.
pub fn neg(self) -> NotNan<T>
impl<T> Num for NotNan<T> where
T: Float,
T: Float,
type FromStrRadixErr = ParseNotNanError<<T as Num>::FromStrRadixErr>
pub fn from_str_radix(
src: &str,
radix: u32
) -> Result<NotNan<T>, <NotNan<T> as Num>::FromStrRadixErr>
src: &str,
radix: u32
) -> Result<NotNan<T>, <NotNan<T> as Num>::FromStrRadixErr>
impl<T> NumCast for NotNan<T> where
T: Float,
T: Float,
pub fn from<F>(n: F) -> Option<NotNan<T>> where
F: ToPrimitive,
F: ToPrimitive,
impl<T> One for NotNan<T> where
T: Float,
T: Float,
pub fn one() -> NotNan<T>
pub fn set_one(&mut self)
[src]
pub fn is_one(&self) -> bool where
Self: PartialEq<Self>,
[src]
Self: PartialEq<Self>,
impl<T> Ord for NotNan<T> where
T: Float,
T: Float,
pub fn cmp(&self, other: &NotNan<T>) -> Ordering
#[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<NotNan<T>> for NotNan<T> where
T: PartialEq<T>,
T: PartialEq<T>,
impl<T> PartialEq<T> for NotNan<T> where
T: Float,
T: Float,
impl<T> PartialOrd<NotNan<T>> for NotNan<T> where
T: PartialOrd<T>,
T: PartialOrd<T>,
pub fn partial_cmp(&self, other: &NotNan<T>) -> Option<Ordering>
#[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> Product<&'a NotNan<T>> for NotNan<T> where
T: 'a + Float + Product<T>,
T: 'a + Float + Product<T>,
impl<T> Product<NotNan<T>> for NotNan<T> where
T: Float + Product<T>,
T: Float + Product<T>,
impl<T> Rem<NotNan<T>> for NotNan<T> where
T: Float,
T: Float,
type Output = NotNan<T>
The resulting type after applying the %
operator.
pub fn rem(self, other: NotNan<T>) -> NotNan<T>
impl<T> Rem<T> for NotNan<T> where
T: Float,
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.
pub fn rem(self, other: T) -> NotNan<T>
impl<T> RemAssign<NotNan<T>> for NotNan<T> where
T: Float + RemAssign<T>,
T: Float + RemAssign<T>,
pub fn rem_assign(&mut self, other: NotNan<T>)
impl<T> RemAssign<T> for NotNan<T> where
T: Float + RemAssign<T>,
T: Float + RemAssign<T>,
Calculates %=
with a float directly.
Panics if the provided value is NaN or the computation results in NaN
pub fn rem_assign(&mut self, other: T)
impl<T> Signed for NotNan<T> where
T: Float + Signed,
T: Float + Signed,
pub fn abs(&self) -> NotNan<T>
pub fn abs_sub(&self, other: &NotNan<T>) -> NotNan<T>
pub fn signum(&self) -> NotNan<T>
pub fn is_positive(&self) -> bool
pub fn is_negative(&self) -> bool
impl<T> StructuralPartialEq for NotNan<T>
impl<T> Sub<NotNan<T>> for NotNan<T> where
T: Float,
T: Float,
type Output = NotNan<T>
The resulting type after applying the -
operator.
pub fn sub(self, other: NotNan<T>) -> NotNan<T>
impl<T> Sub<T> for NotNan<T> where
T: Float,
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.
pub fn sub(self, other: T) -> NotNan<T>
impl<T> SubAssign<NotNan<T>> for NotNan<T> where
T: Float + SubAssign<T>,
T: Float + SubAssign<T>,
pub fn sub_assign(&mut self, other: NotNan<T>)
impl<T> SubAssign<T> for NotNan<T> where
T: Float + SubAssign<T>,
T: Float + SubAssign<T>,
Subtracts a float directly.
Panics if the provided value is NaN or the computation results in NaN
pub fn sub_assign(&mut self, other: T)
impl<'a, T> Sum<&'a NotNan<T>> for NotNan<T> where
T: 'a + Float + Sum<T>,
T: 'a + Float + Sum<T>,
impl<T> Sum<NotNan<T>> for NotNan<T> where
T: Float + Sum<T>,
T: Float + Sum<T>,
impl<T> ToPrimitive for NotNan<T> where
T: Float,
T: Float,
pub fn to_i64(&self) -> Option<i64>
pub fn to_u64(&self) -> Option<u64>
pub fn to_isize(&self) -> Option<isize>
pub fn to_i8(&self) -> Option<i8>
pub fn to_i16(&self) -> Option<i16>
pub fn to_i32(&self) -> Option<i32>
pub fn to_usize(&self) -> Option<usize>
pub fn to_u8(&self) -> Option<u8>
pub fn to_u16(&self) -> Option<u16>
pub fn to_u32(&self) -> Option<u32>
pub fn to_f32(&self) -> Option<f32>
pub fn to_f64(&self) -> Option<f64>
pub fn to_i128(&self) -> Option<i128>
[src]
pub fn to_u128(&self) -> Option<u128>
[src]
impl TryFrom<f32> for NotNan<f32>
type Error = FloatIsNan
The type returned in the event of a conversion error.
pub fn try_from(
v: f32
) -> Result<NotNan<f32>, <NotNan<f32> as TryFrom<f32>>::Error>
v: f32
) -> Result<NotNan<f32>, <NotNan<f32> as TryFrom<f32>>::Error>
impl TryFrom<f64> for NotNan<f64>
type Error = FloatIsNan
The type returned in the event of a conversion error.
pub fn try_from(
v: f64
) -> Result<NotNan<f64>, <NotNan<f64> as TryFrom<f64>>::Error>
v: f64
) -> Result<NotNan<f64>, <NotNan<f64> as TryFrom<f64>>::Error>
impl<T> Zero for NotNan<T> where
T: Float,
T: Float,
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,
pub fn borrow(&self) -> &TⓘNotable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;
[src]
Notable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut TⓘNotable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;
[src]
Notable traits for &'_ mut R
impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;
impl<T> Downcast for T where
T: Any,
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<R, Global>
impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
A: Allocator + 'static,
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
A: Allocator,
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
Notable traits for Box<R, Global>
impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
A: Allocator + 'static,
F: Future + Unpin + ?Sized, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
A: Allocator,
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn as_any(&self) -> &(dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> DowncastSync for T where
T: Any + Send + Sync,
T: Any + Send + Sync,
impl<A> DynCastExt for A
pub fn dyn_cast<T>(
self
) -> Result<<A as DynCastExtHelper<T>>::Target, <A as DynCastExtHelper<T>>::Source> where
T: ?Sized,
A: DynCastExtHelper<T>,
self
) -> Result<<A as DynCastExtHelper<T>>::Target, <A as DynCastExtHelper<T>>::Source> where
T: ?Sized,
A: DynCastExtHelper<T>,
pub fn dyn_upcast<T>(self) -> <A as DynCastExtAdvHelper<T, T>>::Target where
T: ?Sized,
A: DynCastExtAdvHelper<T, T, Source = <A as DynCastExtAdvHelper<T, T>>::Target>,
T: ?Sized,
A: DynCastExtAdvHelper<T, T, Source = <A as DynCastExtAdvHelper<T, T>>::Target>,
pub fn dyn_cast_adv<F, T>(
self
) -> Result<<A as DynCastExtAdvHelper<F, T>>::Target, <A as DynCastExtAdvHelper<F, T>>::Source> where
T: ?Sized,
A: DynCastExtAdvHelper<F, T>,
F: ?Sized,
self
) -> Result<<A as DynCastExtAdvHelper<F, T>>::Target, <A as DynCastExtAdvHelper<F, T>>::Source> where
T: ?Sized,
A: DynCastExtAdvHelper<F, T>,
F: ?Sized,
pub fn dyn_cast_with_config<C>(
self
) -> Result<<A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Target, <A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Source> where
C: DynCastConfig,
A: DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>,
self
) -> Result<<A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Target, <A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Source> where
C: DynCastConfig,
A: DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>,
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> OrdExt<T> for T where
T: Ord + Clone,
[src]
T: Ord + Clone,
pub fn update_max(&mut self, new: &T)
[src]
impl<T> RuleType for T where
T: Copy + Debug + Eq + Hash + Ord,
[src]
T: Copy + Debug + Eq + Hash + Ord,
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,