Expand description
Utilities for comparing and ordering values.
This module contains various tools for comparing and ordering values. In summary:
PartialEq<Rhs>
overloads the==
and!=
operators. In cases whereRhs
(the right hand side’s type) isSelf
, this trait corresponds to a partial equivalence relation.Eq
indicates that the overloaded==
operator corresponds to an equivalence relation.Ord
andPartialOrd
are traits that allow you to define total and partial orderings between values, respectively. Implementing them overloads the<
,<=
,>
, and>=
operators.Ordering
is an enum returned by the main functions ofOrd
andPartialOrd
, and describes an ordering of two values (less, equal, or greater).Reverse
is a struct that allows you to easily reverse an ordering.max
andmin
are functions that build off ofOrd
and allow you to find the maximum or minimum of two values.
For more details, see the respective documentation of each item in the list.
Structs§
- A helper struct for reverse ordering.
Enums§
- An
Ordering
is the result of a comparison between two values.
Traits§
- Trait for comparisons corresponding to equivalence relations.
- Trait for types that form a total order.
- Trait for comparisons using the equality operator.
- Trait for types that form a partial order.
Functions§
- Compares and returns the maximum of two values.
- Returns the maximum of two values with respect to the specified comparison function.