pub trait TotallyOrderable {
type TotalOrdKey: Ord + Hash + Sized;
// Required methods
fn total_eq(&self, other: &Self) -> bool;
fn total_cmp(&self, other: &Self) -> Ordering;
fn total_hash<H: Hasher>(&self, state: &mut H);
fn total_ord_key(&self) -> Self::TotalOrdKey;
}Expand description
Implement this for types that are not directly Ord + Eq, but
can be at a slightly higher runtime cost. Implemented for f32
and f64.
Required Associated Types§
type TotalOrdKey: Ord + Hash + Sized
Required Methods§
Sourcefn total_eq(&self, other: &Self) -> bool
fn total_eq(&self, other: &Self) -> bool
A true equality comparison. Can be more expensive than standard
PartialEq.
Sourcefn total_cmp(&self, other: &Self) -> Ordering
fn total_cmp(&self, other: &Self) -> Ordering
A totally ordered comparison. Can be more expensive than standard
PartialOrd.
Sourcefn total_hash<H: Hasher>(&self, state: &mut H)
fn total_hash<H: Hasher>(&self, state: &mut H)
A hashing function that matches total_eq. As the wrapped type
doesn’t implement Eq, it can’t be Hash directly.
fn total_ord_key(&self) -> Self::TotalOrdKey
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl TotallyOrderable for f32
Implements the IEEE 754-2008 binary32/binary64 total ordering predicate.
impl TotallyOrderable for f32
Implements the IEEE 754-2008 binary32/binary64 total ordering predicate.
Source§impl TotallyOrderable for f64
Implements the IEEE 754-2008 binary32/binary64 total ordering predicate.
impl TotallyOrderable for f64
Implements the IEEE 754-2008 binary32/binary64 total ordering predicate.