Trait MinMax

Source
pub trait MinMax {
    // Required methods
    fn min(self, other: Self) -> Self;
    fn max(self, other: Self) -> Self;
    fn clamp(self, min: Self, max: Self) -> Self;
}
Expand description

Provides min, max, and clamp that are not necessarily consistent with those from Ord. This is provided because f32 and f64 do not implement Ord, so this trait is defined to give a uniform interface with Ord types.

Required Methods§

Source

fn min(self, other: Self) -> Self

Source

fn max(self, other: Self) -> Self

Source

fn clamp(self, min: Self, max: Self) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl MinMax for f32

Source§

fn min(self, other: Self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

fn clamp(self, min: Self, max: Self) -> Self

Source§

impl MinMax for f64

Source§

fn min(self, other: Self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

fn clamp(self, min: Self, max: Self) -> Self

Source§

impl MinMax for i8

Source§

fn min(self, other: Self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

fn clamp(self, min: Self, max: Self) -> Self

Source§

impl MinMax for i16

Source§

fn min(self, other: Self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

fn clamp(self, min: Self, max: Self) -> Self

Source§

impl MinMax for i32

Source§

fn min(self, other: Self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

fn clamp(self, min: Self, max: Self) -> Self

Source§

impl MinMax for i64

Source§

fn min(self, other: Self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

fn clamp(self, min: Self, max: Self) -> Self

Source§

impl<U> MinMax for FixedI8<U>
where U: Unsigned + LtU8,

Source§

fn min(self, other: Self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

fn clamp(self, min: Self, max: Self) -> Self

Source§

impl<U> MinMax for FixedI16<U>
where U: Unsigned + LtU16,

Source§

fn min(self, other: Self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

fn clamp(self, min: Self, max: Self) -> Self

Source§

impl<U> MinMax for FixedI32<U>
where U: Unsigned + LtU32,

Source§

fn min(self, other: Self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

fn clamp(self, min: Self, max: Self) -> Self

Source§

impl<U> MinMax for FixedI64<U>
where U: Unsigned + LtU64,

Source§

fn min(self, other: Self) -> Self

Source§

fn max(self, other: Self) -> Self

Source§

fn clamp(self, min: Self, max: Self) -> Self

Implementors§