Struct thrift::OrderedFloat
source · 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<OrderedFloat<T>> for OrderedFloat<T>where
T: Float,
impl<T> Add<OrderedFloat<T>> 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>where
T: Clone + Float,
impl<T> Clone for OrderedFloat<T>where
T: Clone + Float,
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> Default for OrderedFloat<T>where
T: Default + Float,
impl<T> Default for OrderedFloat<T>where
T: Default + Float,
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> Div<OrderedFloat<T>> for OrderedFloat<T>where
T: Float,
impl<T> Div<OrderedFloat<T>> 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>where
T: Float + FromStr,
impl<T> FromStr for OrderedFloat<T>where
T: Float + FromStr,
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<OrderedFloat<T>> for OrderedFloat<T>where
T: Float,
impl<T> Mul<OrderedFloat<T>> 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<OrderedFloat<T>> for OrderedFloat<T>where
T: Float,
impl<T> PartialEq<OrderedFloat<T>> for OrderedFloat<T>where
T: Float,
source§fn eq(&self, other: &OrderedFloat<T>) -> bool
fn eq(&self, other: &OrderedFloat<T>) -> bool
source§impl<T> PartialOrd<OrderedFloat<T>> for OrderedFloat<T>where
T: Float,
impl<T> PartialOrd<OrderedFloat<T>> 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<OrderedFloat<T>> for OrderedFloat<T>where
T: Float,
impl<T> Sub<OrderedFloat<T>> 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 more