Struct ordered_float::OrderedFloat
[−]
[src]
pub struct OrderedFloat<T: Float>(pub T);
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.
Methods
impl<T: Float> OrderedFloat<T>
[src]
pub fn into_inner(self) -> T
[src]
Get the value out.
Trait Implementations
impl<T: Float + Serialize> Serialize for OrderedFloat<T>
[src]
fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>
[src]
Serialize this value into the given Serde serializer. Read more
impl<'de, T: Float + Deserialize<'de>> Deserialize<'de> for OrderedFloat<T>
[src]
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
[src]
Deserialize this value from the given Serde deserializer. Read more
impl<T: PartialOrd + Float> PartialOrd for OrderedFloat<T>
[src]
fn partial_cmp(&self, __arg_0: &OrderedFloat<T>) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &OrderedFloat<T>) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &OrderedFloat<T>) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &OrderedFloat<T>) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &OrderedFloat<T>) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T: Debug + Float> Debug for OrderedFloat<T>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T: Default + Float> Default for OrderedFloat<T>
[src]
fn default() -> OrderedFloat<T>
[src]
Returns the "default value" for a type. Read more
impl<T: Clone + Float> Clone for OrderedFloat<T>
[src]
fn clone(&self) -> OrderedFloat<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Copy + Float> Copy for OrderedFloat<T>
[src]
impl<T: Float> AsRef<T> for OrderedFloat<T>
[src]
impl<T: Float> AsMut<T> for OrderedFloat<T>
[src]
impl<T: Float + PartialOrd> Ord for OrderedFloat<T>
[src]
fn cmp(&self, other: &OrderedFloat<T>) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
impl<T: Float + PartialEq> PartialEq for OrderedFloat<T>
[src]
fn eq(&self, other: &OrderedFloat<T>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<T: Float> Hash for OrderedFloat<T>
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: Float + Display> Display for OrderedFloat<T>
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Into<f32> for OrderedFloat<f32>
[src]
impl Into<f64> for OrderedFloat<f64>
[src]
impl<T: Float> From<T> for OrderedFloat<T>
[src]
impl<T: Float> Deref for OrderedFloat<T>
[src]
type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
Dereferences the value.