pub trait ToOrd: Sized + Copy {
type Ord: Ord;
// Required method
fn to_ord(self) -> Self::Ord;
// Provided method
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.
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.
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.
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!).