Module std::cmp 1.0.0[−][src]
Functionality for ordering and comparison.
This module contains various tools for ordering and comparing values. In summary:
EqandPartialEqare traits that allow you to define total and partial equality between values, respectively. Implementing them overloads the==and!=operators.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.Reverseis 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.
Macros
| Eq | Derive macro generating an impl of the trait |
| Ord | Derive macro generating an impl of the trait |
| PartialEq | Derive macro generating an impl of the trait |
| PartialOrd | Derive macro generating an impl of the trait |
Structs
| Reverse | A helper struct for reverse ordering. |
Enums
| Ordering | An |
Traits
| Eq | Trait for equality comparisons which are equivalence relations. |
| Ord | Trait for types that form a total order. |
| PartialEq | Trait for equality comparisons which are partial equivalence relations. |
| PartialOrd | Trait for values that can be compared for a sort-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. |
| max_by_key | Returns the element that gives the maximum value from the specified function. |
| min | Compares and returns the minimum of two values. |
| min_by | Returns the minimum of two values with respect to the specified comparison function. |
| min_by_key | Returns the element that gives the minimum value from the specified function. |