# 1.0.0[−][src]Module std::cmp

Functionality for ordering and comparison.

This module contains various tools for ordering and comparing values. In summary:

- [`Eq`] and [`PartialEq`] are traits that allow you to define total and partial equality between values, respectively. Implementing them overloads the `==` and `!=` operators.
- [`Ord`] and [`PartialOrd`] are traits that allow you to define total and partial orderings between values, respectively. Implementing them overloads the `<`, `<=`, `>`, and `>=` operators.
- [`Ordering`][cmp::Ordering] is an enum returned by the main functions of [`Ord`] and [`PartialOrd`], and describes an ordering.
- [`Reverse`][cmp::Reverse] is a struct that allows you to easily reverse an ordering.
- [`max`][cmp::max] and [`min`][cmp::min] are functions that build off of [`Ord`] 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

Reverse | A helper struct for reverse ordering.

## Enums

Ordering | An `Ordering` is the result of a comparison between two values.

## 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.
min | Compares and returns the minimum of two values.

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)