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.Eqindicates that the overloaded==operator corresponds to an equivalence relation.OrdandPartialOrdare traits that allow you to define total and partial orderings between values, respectively. Implementing them overloads the<,<=,>, and>=operators.Orderingis an enum returned by the main functions ofOrdandPartialOrd, and describes an ordering of two values (less, equal, or greater).- [
Reverse] is a struct that allows you to easily reverse an ordering. maxandminare functions that build off ofOrdand allow you to find the maximum or minimum of two values.
For more details, see the respective documentation of each item in the list.
Enums§
- Ordering
- An
Orderingis the result of a comparison between two values.
Traits§
- Eq
- Trait for comparisons corresponding to equivalence relations.
- Ord
- Trait for types that form a total order.
- Partial
Eq - Trait for comparisons using the equality operator.
- Partial
Ord - Trait for types that form a partial order.
Functions§
- max
- Compares and returns the maximum of two values.
- max_by
- Returns the maximum of two values with respect to the specified comparison function.
- min
- Compares and returns the minimum of two values.
Derive Macros§
- Eq
- Derive macro generating an impl of the trait
Eq. - Partial
Eq - Derive macro generating an impl of the trait
PartialEq. The behavior of this macro is described in detail here. - Partial
Ord - Derive macro generating an impl of the trait
PartialOrd. The behavior of this macro is described in detail here.