pub trait OptionMinMax<Other, Inner = Other> {
    fn opt_min(self, other: Other) -> Option<Inner>;
    fn opt_max(self, other: Other) -> Option<Inner>;
}
Expand description

Trait for values and Options that can be compared to get the minimum or maximum.

Implementing this type leads to the following auto-implementations:

  • OptionMinMax<Option<InnerRhs>> for T.
  • OptionMinMax<Rhs> for Option<T>.
  • OptionMinMax<Option<InnerRhs>> for Option<T>.
  • … and some variants with references.

This trait is auto-implemented for OptionOperations types implementing OptionOrd<Rhs>.

Required Methods

Compares and returns the minimum of two values.

Returns None if they can’t be compared, e.g. if at most one argument is None.

Compares and returns the maximum of two values.

Returns None if they can’t be compared, e.g. if at most one argument is None.

Implementations on Foreign Types

Implementors