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].

Object Safety§

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§