Module std::cmp
The Ord
and Eq
comparison traits
This module contains the definition of both Ord
and Eq
which define
the common interfaces for doing comparison. Both are language items
that the compiler uses to implement the comparison operators. Rust code
may implement Ord
to overload the <
, <=
, >
, and >=
operators,
and Eq
to overload the ==
and !=
operators.
Enums
Ordering |
Traits
Eq | Trait for values that can be compared for equality and inequality. |
Equiv | The equivalence relation. Two values may be equivalent even if they are
of different types. The most common use case for this relation is
container types; e.g. it is often desirable to be able to use |
Ord | Trait for values that can be compared for a sort-order. |
TotalEq | Trait for equality comparisons where |
TotalOrd | Trait for types that form a total order |
Functions
lexical_ordering | Return |
max | |
min |