Trait cosmic::cosmic_theme::palette::num::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: f32, max: f32) -> f32

source§

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

source§

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

source§

impl Clamp for f64

source§

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

source§

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

source§

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

source§

impl Clamp for u8

source§

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

source§

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

source§

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

source§

impl Clamp for u16

source§

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

source§

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

source§

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

source§

impl Clamp for u32

source§

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

source§

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

source§

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

source§

impl Clamp for u64

source§

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

source§

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

source§

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

source§

impl Clamp for u128

source§

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

source§

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

source§

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

Implementors§