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.0.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