std::cmp - Rust (original) (raw)

Expand description

Utilities for comparing and ordering values.

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

For more details, see the respective documentation of each item in the list.

Reverse

A helper struct for reverse ordering.

Ordering

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

Eq

Trait for comparisons corresponding to equivalence relations.

Ord

Trait for types that form a total order.

PartialEq

Trait for comparisons using the equality operator.

PartialOrd

Trait for types that form a partial order.

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.

minmaxExperimental

Compares and sorts two values, returning minimum and maximum.

minmax_byExperimental

Returns minimum and maximum values with respect to the specified comparison function.

minmax_by_keyExperimental

Returns minimum and maximum values with respect to the specified key function.

Eq

Derive macro generating an impl of the trait Eq.

Ord

Derive macro generating an impl of the trait Ord. The behavior of this macro is described in detail here.

PartialEq

Derive macro generating an impl of the trait PartialEq. The behavior of this macro is described in detail here.

PartialOrd

Derive macro generating an impl of the trait PartialOrd. The behavior of this macro is described in detail here.