pub trait ToOrd: Sized + Copy {
    type Ord: Ord;
    fn to_ord(self) -> Self::Ord;

    fn total_eq(self, rhs: Self) -> bool { ... }
}
Expand description

A trait that converts a floating point number into something implementing total ordering.

The behavior of this trait is unspecified for NaN, and may result in a logic error.

Associated Types

A type implementing total ordering, which a float can be trivially converted to.

The exact value of this associated type should be considered opaque, and is subject to change in minor releases.

Required methods

Trivially converts this floating point number into one that implements total ordering. When implementing this, ensure that -0.0 == 0.0.

Behavior is usnpecified for NaN and may result in a logic error.

Provided methods

Checks two floating point numbers for total equality, ensuring that -0.0 == 0.0.

This has a default implementation based on to_ord. Only override this if you can provide a more performant implementation (benchmark!).

Implementations on Foreign Types

Implementors