pub trait OrdContext<T> {
// Required method
fn less(&self, a: &T, b: &T) -> bool;
}Expand description
Provides a total ordering for elements of type T.
Implementors replace the standard Ord / PartialOrd traits, enabling
context-dependent orderings (e.g. reverse order, key-extracted order)
without newtype wrappers.
§Contract
less must define a strict weak ordering:
- Irreflexivity:
less(a, a)isfalse. - Asymmetry: if
less(a, b)then!less(b, a). - Transitivity: if
less(a, b)andless(b, c)thenless(a, c).