Skip to main content

MinMax

Trait MinMax 

Source
pub trait MinMax: Sized {
    type T;

    // Required method
    fn min_max(self) -> (Self::T, Self::T);

    // Provided methods
    fn min(self) -> Self::T { ... }
    fn max(self) -> Self::T { ... }
}
Expand description

Extension trait for getting minimum/maximum of values grouped together

Required Associated Types§

Source

type T

Type of a single value

Required Methods§

Source

fn min_max(self) -> (Self::T, Self::T)

Find (min, max)

Provided Methods§

Source

fn min(self) -> Self::T

Find min

Source

fn max(self) -> Self::T

Find max

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: Ord> MinMax for (T, T)

Source§

type T = T

Source§

fn min_max(self) -> (T, T)

Implementors§