Struct ordered_float::OrderedFloat [−][src]
#[repr(transparent)]pub struct OrderedFloat<T: Float>(pub T);
Expand description
A wrapper around Floats providing an implementation of Ord and Hash.
NaN is sorted as greater than all other values and equal to itself, in contradiction with the IEEE standard.
Tuple Fields
0: T
Implementations
Get the value out.
Trait Implementations
Returns the “default value” for a type. Read more
Convert a &str to OrderedFloat
. Returns an error if the string fails to parse.
use ordered_float::OrderedFloat;
assert!("-10".parse::<OrderedFloat<f32>>().is_ok());
assert!("abc".parse::<OrderedFloat<f32>>().is_err());
assert!("NaN".parse::<OrderedFloat<f32>>().is_ok());
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for OrderedFloat<T> where
T: RefUnwindSafe,
impl<T> Send for OrderedFloat<T> where
T: Send,
impl<T> Sync for OrderedFloat<T> where
T: Sync,
impl<T> Unpin for OrderedFloat<T> where
T: Unpin,
impl<T> UnwindSafe for OrderedFloat<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more