TotallyOrderable

Trait TotallyOrderable 

Source
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§

Required Methods§

Source

fn total_eq(&self, other: &Self) -> bool

A true equality comparison. Can be more expensive than standard PartialEq.

Source

fn total_cmp(&self, other: &Self) -> Ordering

A totally ordered comparison. Can be more expensive than standard PartialOrd.

Source

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.

Source

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.

Source§

type TotalOrdKey = i32

Source§

fn total_eq(&self, other: &Self) -> bool

Source§

fn total_cmp(&self, other: &Self) -> Ordering

Source§

fn total_hash<H: Hasher>(&self, state: &mut H)

Source§

fn total_ord_key(&self) -> Self::TotalOrdKey

Source§

impl TotallyOrderable for f64

Implements the IEEE 754-2008 binary32/binary64 total ordering predicate.

Source§

type TotalOrdKey = i64

Source§

fn total_eq(&self, other: &Self) -> bool

Source§

fn total_cmp(&self, other: &Self) -> Ordering

Source§

fn total_hash<H: Hasher>(&self, state: &mut H)

Source§

fn total_ord_key(&self) -> Self::TotalOrdKey

Implementors§