pub struct OrderedFloat<T>(pub T);
Expand description
Wraps a floating-point value to add total order and hash.
Possible types for T
are f32
and f64
.
All NaNs are considered equal to each other. The size of zero is ignored.
See also Float
.
Tuple Fields§
§0: T
Implementations§
source§impl<T> OrderedFloat<T>
impl<T> OrderedFloat<T>
pub fn into_inner(self) -> T
Trait Implementations§
source§impl<T> Clone for OrderedFloat<T>where
T: Clone,
impl<T> Clone for OrderedFloat<T>where
T: Clone,
source§fn clone(&self) -> OrderedFloat<T>
fn clone(&self) -> OrderedFloat<T>
Returns a copy of the value. Read more
1.6.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T> From<T> for OrderedFloat<T>
impl<T> From<T> for OrderedFloat<T>
source§fn from(val: T) -> OrderedFloat<T>
fn from(val: T) -> OrderedFloat<T>
Converts to this type from the input type.
source§impl<T> Hash for OrderedFloat<T>where
T: Float,
impl<T> Hash for OrderedFloat<T>where
T: Float,
source§impl<T> Ord for OrderedFloat<T>where
T: Float,
impl<T> Ord for OrderedFloat<T>where
T: Float,
source§fn cmp(&self, other: &OrderedFloat<T>) -> Ordering
fn cmp(&self, other: &OrderedFloat<T>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<T> PartialEq for OrderedFloat<T>where
T: Float,
impl<T> PartialEq for OrderedFloat<T>where
T: Float,
source§impl<T> PartialOrd for OrderedFloat<T>where
T: Float,
impl<T> PartialOrd for OrderedFloat<T>where
T: Float,
impl<T> Copy for OrderedFloat<T>where
T: Copy,
impl<T> Eq for OrderedFloat<T>where
T: Float,
Auto Trait Implementations§
impl<T> Freeze for OrderedFloat<T>where
T: Freeze,
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more