Struct thrift::OrderedFloat
source · #[repr(transparent)]pub struct OrderedFloat<T>(pub T)
where
T: Float;
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§
source§impl<T> OrderedFloat<T>where
T: Float,
impl<T> OrderedFloat<T>where
T: Float,
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Get the value out.
Trait Implementations§
source§impl<T> Add for OrderedFloat<T>where
T: Float,
impl<T> Add for OrderedFloat<T>where
T: Float,
§type Output = OrderedFloat<T>
type Output = OrderedFloat<T>
The resulting type after applying the
+
operator.source§fn add(self, other: OrderedFloat<T>) -> OrderedFloat<T>
fn add(self, other: OrderedFloat<T>) -> OrderedFloat<T>
Performs the
+
operation. Read moresource§impl<T> AsMut<T> for OrderedFloat<T>where
T: Float,
impl<T> AsMut<T> for OrderedFloat<T>where
T: Float,
source§impl<T> AsRef<T> for OrderedFloat<T>where
T: Float,
impl<T> AsRef<T> for OrderedFloat<T>where
T: Float,
source§impl<T> Bounded for OrderedFloat<T>where
T: Float,
impl<T> Bounded for OrderedFloat<T>where
T: Float,
source§fn min_value() -> OrderedFloat<T>
fn min_value() -> OrderedFloat<T>
Returns the smallest finite number this type can represent
source§fn max_value() -> OrderedFloat<T>
fn max_value() -> OrderedFloat<T>
Returns the largest finite number this type can represent
source§impl<T> Clone for OrderedFloat<T>
impl<T> Clone for OrderedFloat<T>
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> Debug for OrderedFloat<T>
impl<T> Debug for OrderedFloat<T>
source§impl<T> Default for OrderedFloat<T>
impl<T> Default for OrderedFloat<T>
source§fn default() -> OrderedFloat<T>
fn default() -> OrderedFloat<T>
Returns the “default value” for a type. Read more
source§impl<T> Deref for OrderedFloat<T>where
T: Float,
impl<T> Deref for OrderedFloat<T>where
T: Float,
source§impl<T> DerefMut for OrderedFloat<T>where
T: Float,
impl<T> DerefMut for OrderedFloat<T>where
T: Float,
source§impl<T> Display for OrderedFloat<T>
impl<T> Display for OrderedFloat<T>
source§impl<T> Div for OrderedFloat<T>where
T: Float,
impl<T> Div for OrderedFloat<T>where
T: Float,
§type Output = OrderedFloat<T>
type Output = OrderedFloat<T>
The resulting type after applying the
/
operator.source§fn div(self, other: OrderedFloat<T>) -> OrderedFloat<T>
fn div(self, other: OrderedFloat<T>) -> OrderedFloat<T>
Performs the
/
operation. Read moresource§impl<T> From<T> for OrderedFloat<T>where
T: Float,
impl<T> From<T> for OrderedFloat<T>where
T: Float,
source§fn from(val: T) -> OrderedFloat<T>
fn from(val: T) -> OrderedFloat<T>
Converts to this type from the input type.
source§impl<T> FromStr for OrderedFloat<T>
impl<T> FromStr for OrderedFloat<T>
source§fn from_str(
s: &str,
) -> Result<OrderedFloat<T>, <OrderedFloat<T> as FromStr>::Err>
fn from_str( s: &str, ) -> Result<OrderedFloat<T>, <OrderedFloat<T> as FromStr>::Err>
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());
source§impl<T> Hash for OrderedFloat<T>where
T: Float,
impl<T> Hash for OrderedFloat<T>where
T: Float,
source§impl<T> Mul for OrderedFloat<T>where
T: Float,
impl<T> Mul for OrderedFloat<T>where
T: Float,
§type Output = OrderedFloat<T>
type Output = OrderedFloat<T>
The resulting type after applying the
*
operator.source§fn mul(self, other: OrderedFloat<T>) -> OrderedFloat<T>
fn mul(self, other: OrderedFloat<T>) -> OrderedFloat<T>
Performs the
*
operation. Read moresource§impl<T> Neg for OrderedFloat<T>where
T: Float,
impl<T> Neg for OrderedFloat<T>where
T: Float,
§type Output = OrderedFloat<T>
type Output = OrderedFloat<T>
The resulting type after applying the
-
operator.source§fn neg(self) -> OrderedFloat<T>
fn neg(self) -> OrderedFloat<T>
Performs the unary
-
operation. Read moresource§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§fn eq(&self, other: &OrderedFloat<T>) -> bool
fn eq(&self, other: &OrderedFloat<T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<T> PartialOrd for OrderedFloat<T>where
T: Float,
impl<T> PartialOrd for OrderedFloat<T>where
T: Float,
source§fn partial_cmp(&self, other: &OrderedFloat<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &OrderedFloat<T>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<T> Sub for OrderedFloat<T>where
T: Float,
impl<T> Sub for OrderedFloat<T>where
T: Float,
§type Output = OrderedFloat<T>
type Output = OrderedFloat<T>
The resulting type after applying the
-
operator.source§fn sub(self, other: OrderedFloat<T>) -> OrderedFloat<T>
fn sub(self, other: OrderedFloat<T>) -> OrderedFloat<T>
Performs the
-
operation. Read moresource§impl<T> Zero for OrderedFloat<T>where
T: Float,
impl<T> Zero for OrderedFloat<T>where
T: Float,
impl<T> Copy for OrderedFloat<T>
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: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)