palette::num

Trait Clamp

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

Trait for clamping a value.

Required Methods§

Source

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

Clamp self to be within the range [min, max].

Source

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

Clamp self to be within the range [min, ∞).

Source

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

Clamp self to be within the range (-∞, max].

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 Clamp for f32

Source§

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

Source§

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

Source§

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

Source§

impl Clamp for f64

Source§

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

Source§

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

Source§

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

Source§

impl Clamp for u8

Source§

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

Source§

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

Source§

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

Source§

impl Clamp for u16

Source§

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

Source§

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

Source§

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

Source§

impl Clamp for u32

Source§

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

Source§

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

Source§

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

Source§

impl Clamp for u64

Source§

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

Source§

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

Source§

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

Source§

impl Clamp for u128

Source§

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

Source§

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

Source§

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

Implementors§