Skip to main content

RangeDefault

Trait RangeDefault 

Source
pub trait RangeDefault: MinValue + MaxValue {
    const RANGE_MIN: Self;
    const RANGE_HALF: Self;
    const RANGE_MAX: Self;
    const RANGE: Self;

    // Provided methods
    fn range() -> Range<Self>  { ... }
    fn range_inclusive() -> RangeInclusive<Self> { ... }
}
Expand description

For floating the range is : [0., 1.]. For integers the range is : [0, MAX], even for signed

Required Associated Constants§

Source

const RANGE_MIN: Self

Source

const RANGE_HALF: Self

Useful for stuff like Color::GRAY

RANGE / 2 + RANGE

Source

const RANGE_MAX: Self

Source

const RANGE: Self

RANGE_MAX - RANGE_MIN

Provided Methods§

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 RangeDefault for bool

Source§

const RANGE_MIN: bool = false

Source§

const RANGE_HALF: bool = false

Source§

const RANGE_MAX: bool = true

Source§

const RANGE: bool = true

Source§

impl RangeDefault for f32

Source§

const RANGE_MIN: f32 = Self::ZERO

Source§

const RANGE_HALF: f32

Source§

const RANGE_MAX: f32 = Self::ONE

Source§

const RANGE: f32

Source§

impl RangeDefault for f64

Source§

const RANGE_MIN: f64 = Self::ZERO

Source§

const RANGE_HALF: f64

Source§

const RANGE_MAX: f64 = Self::ONE

Source§

const RANGE: f64

Source§

impl RangeDefault for i8

Source§

const RANGE_MIN: i8 = Self::ZERO

Source§

const RANGE_HALF: i8

Source§

const RANGE_MAX: i8 = Self::MAX

Source§

const RANGE: i8

Source§

impl RangeDefault for i16

Source§

const RANGE_MIN: i16 = Self::ZERO

Source§

const RANGE_HALF: i16

Source§

const RANGE_MAX: i16 = Self::MAX

Source§

const RANGE: i16

Source§

impl RangeDefault for i32

Source§

const RANGE_MIN: i32 = Self::ZERO

Source§

const RANGE_HALF: i32

Source§

const RANGE_MAX: i32 = Self::MAX

Source§

const RANGE: i32

Source§

impl RangeDefault for i64

Source§

const RANGE_MIN: i64 = Self::ZERO

Source§

const RANGE_HALF: i64

Source§

const RANGE_MAX: i64 = Self::MAX

Source§

const RANGE: i64

Source§

impl RangeDefault for isize

Source§

const RANGE_MIN: isize = Self::ZERO

Source§

const RANGE_HALF: isize

Source§

const RANGE_MAX: isize = Self::MAX

Source§

const RANGE: isize

Source§

impl RangeDefault for u8

Source§

const RANGE_MIN: u8 = Self::ZERO

Source§

const RANGE_HALF: u8

Source§

const RANGE_MAX: u8 = Self::MAX

Source§

const RANGE: u8

Source§

impl RangeDefault for u16

Source§

const RANGE_MIN: u16 = Self::ZERO

Source§

const RANGE_HALF: u16

Source§

const RANGE_MAX: u16 = Self::MAX

Source§

const RANGE: u16

Source§

impl RangeDefault for u32

Source§

const RANGE_MIN: u32 = Self::ZERO

Source§

const RANGE_HALF: u32

Source§

const RANGE_MAX: u32 = Self::MAX

Source§

const RANGE: u32

Source§

impl RangeDefault for u64

Source§

const RANGE_MIN: u64 = Self::ZERO

Source§

const RANGE_HALF: u64

Source§

const RANGE_MAX: u64 = Self::MAX

Source§

const RANGE: u64

Source§

impl RangeDefault for usize

Source§

const RANGE_MIN: usize = Self::ZERO

Source§

const RANGE_HALF: usize

Source§

const RANGE_MAX: usize = Self::MAX

Source§

const RANGE: usize

Implementors§

Source§

impl<T> RangeDefault for AngleOf<T>
where T: Float,

Source§

const RANGE_MIN: AngleOf<T> = Self::ZERO

Source§

const RANGE_HALF: AngleOf<T> = Self::FLAT

Source§

const RANGE_MAX: AngleOf<T> = Self::FULL

Source§

const RANGE: AngleOf<T> = Self::FULL

Source§

impl<T> RangeDefault for TimeOf<T>
where T: Float + RangeDefault,