Movatterモバイル変換


[0]ホーム

URL:


Module cmp

std

Modulecmp 

1.0.0 ·Source
Expand description

Utilities for comparing and ordering values.

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

  • PartialEq<Rhs> overloads the== and!= operators. In cases whereRhs (the right hand side’s type) isSelf, this trait corresponds to apartial equivalence relation.
  • Eq indicates that the overloaded== operator corresponds to anequivalence relation.
  • Ord andPartialOrd are traits that allow you to define total andpartial orderings between values, respectively. Implementing them overloadsthe<,<=,>, and>= operators.
  • Ordering is an enum returned by the main functions ofOrd andPartialOrd, and describes an ordering of two values (less, equal, orgreater).
  • Reverse is a struct that allows you to easily reverse an ordering.
  • max andmin are functions that build off ofOrd and allow youto 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
AnOrdering is the result of a comparison between two values.

Traits§

Eq
Trait for comparisons corresponding toequivalence relations.
Ord
Trait for types that form atotal order.
PartialEq
Trait for comparisons using the equality operator.
PartialOrd
Trait for types that form apartial 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.
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.

Derive Macros§

Eq
Derive macro generating an impl of the traitEq.
Ord
Derive macro generating an impl of the traitOrd.The behavior of this macro is described in detailhere.
PartialEq
Derive macro generating an impl of the traitPartialEq.The behavior of this macro is described in detailhere.
PartialOrd
Derive macro generating an impl of the traitPartialOrd.The behavior of this macro is described in detailhere.

[8]ページ先頭

©2009-2026 Movatter.jp