[−][src]Struct ordered_float::OrderedFloat
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]
impl<T: Float> OrderedFloat<T>
pub fn into_inner(self) -> T
[src]
pub fn into_inner(self) -> T
Get the value out.
Trait Implementations
impl<T: Float + PartialOrd> PartialOrd<OrderedFloat<T>> for OrderedFloat<T>
[src]
impl<T: Float + PartialOrd> PartialOrd<OrderedFloat<T>> for OrderedFloat<T>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
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 more
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T: Float + PartialEq> PartialEq<OrderedFloat<T>> for OrderedFloat<T>
[src]
impl<T: Float + PartialEq> PartialEq<OrderedFloat<T>> for OrderedFloat<T>
fn eq(&self, other: &OrderedFloat<T>) -> bool
[src]
fn eq(&self, other: &OrderedFloat<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<T: Default + Float> Default for OrderedFloat<T>
[src]
impl<T: Default + Float> Default for OrderedFloat<T>
fn default() -> OrderedFloat<T>
[src]
fn default() -> OrderedFloat<T>
Returns the "default value" for a type. Read more
impl<T: Clone + Float> Clone for OrderedFloat<T>
[src]
impl<T: Clone + Float> Clone for OrderedFloat<T>
fn clone(&self) -> OrderedFloat<T>
[src]
fn clone(&self) -> OrderedFloat<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: Float> AsRef<T> for OrderedFloat<T>
[src]
impl<T: Float> AsRef<T> for OrderedFloat<T>
impl Into<f32> for OrderedFloat<f32>
[src]
impl Into<f32> for OrderedFloat<f32>
impl Into<f64> for OrderedFloat<f64>
[src]
impl Into<f64> for OrderedFloat<f64>
impl<T: Float + PartialOrd> Ord for OrderedFloat<T>
[src]
impl<T: Float + PartialOrd> Ord for OrderedFloat<T>
fn cmp(&self, other: &Self) -> Ordering
[src]
fn cmp(&self, other: &Self) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl<T: Copy + Float> Copy for OrderedFloat<T>
[src]
impl<T: Copy + Float> Copy for OrderedFloat<T>
impl<T: Float> From<T> for OrderedFloat<T>
[src]
impl<T: Float> From<T> for OrderedFloat<T>
impl<T: Float + PartialEq> Eq for OrderedFloat<T>
[src]
impl<T: Float + PartialEq> Eq for OrderedFloat<T>
impl<T: Float> AsMut<T> for OrderedFloat<T>
[src]
impl<T: Float> AsMut<T> for OrderedFloat<T>
impl<T: Float + Display> Display for OrderedFloat<T>
[src]
impl<T: Float + Display> Display for OrderedFloat<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T: Debug + Float> Debug for OrderedFloat<T>
[src]
impl<T: Debug + Float> Debug for OrderedFloat<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T: Float> Deref for OrderedFloat<T>
[src]
impl<T: Float> Deref for OrderedFloat<T>
type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
fn deref(&self) -> &Self::Target
Dereferences the value.
impl<T: Float> DerefMut for OrderedFloat<T>
[src]
impl<T: Float> DerefMut for OrderedFloat<T>
impl<T: Float> Hash for OrderedFloat<T>
[src]
impl<T: Float> Hash for OrderedFloat<T>
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash<H: Hasher>(&self, state: &mut H)
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]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: Float + Serialize> Serialize for OrderedFloat<T>
[src]
impl<T: Float + Serialize> Serialize for OrderedFloat<T>
fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>
[src]
fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>
Serialize this value into the given Serde serializer. Read more
impl<'de, T: Float + Deserialize<'de>> Deserialize<'de> for OrderedFloat<T>
[src]
impl<'de, T: Float + Deserialize<'de>> Deserialize<'de> for OrderedFloat<T>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
[src]
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl<T> Send for OrderedFloat<T> where
T: Send,
impl<T> Send for OrderedFloat<T> where
T: Send,
impl<T> Sync for OrderedFloat<T> where
T: Sync,
impl<T> Sync for OrderedFloat<T> where
T: Sync,
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> ToString for T where
T: Display + ?Sized,
[src]
impl<T> ToString for T where
T: Display + ?Sized,
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,