Trait DefaultRange

Source
pub trait DefaultRange: MinValue + MaxValue {
    const MIN_RANGE: Self;
    const HALF_RANGE: Self;
    const MAX_RANGE: Self;
    const RANGE: 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 MIN_RANGE: Self

Source

const HALF_RANGE: Self

Useful for stuff like Color::GRAY

Source

const MAX_RANGE: Self

Source

const RANGE: Self

MAX_RANGE - MIN_RANGE

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

Source§

const MIN_RANGE: Self = 0f32

Source§

const HALF_RANGE: Self = 0.5f32

Source§

const MAX_RANGE: Self = 1f32

Source§

const RANGE: Self = 1f32

Source§

impl DefaultRange for f64

Source§

const MIN_RANGE: Self = 0f64

Source§

const HALF_RANGE: Self = 0.5f64

Source§

const MAX_RANGE: Self = 1f64

Source§

const RANGE: Self = 1f64

Source§

impl DefaultRange for i8

Source§

const MIN_RANGE: Self = 0i8

Source§

const HALF_RANGE: Self = 63i8

Source§

const MAX_RANGE: Self = 127i8

Source§

const RANGE: Self = 127i8

Source§

impl DefaultRange for i16

Source§

const MIN_RANGE: Self = 0i16

Source§

const HALF_RANGE: Self = 16_383i16

Source§

const MAX_RANGE: Self = 32_767i16

Source§

const RANGE: Self = 32_767i16

Source§

impl DefaultRange for i32

Source§

const MIN_RANGE: Self = 0i32

Source§

const HALF_RANGE: Self = 1_073_741_823i32

Source§

const MAX_RANGE: Self = 2_147_483_647i32

Source§

const RANGE: Self = 2_147_483_647i32

Source§

impl DefaultRange for i64

Source§

const MIN_RANGE: Self = 0i64

Source§

const HALF_RANGE: Self = 4_611_686_018_427_387_903i64

Source§

const MAX_RANGE: Self = 9_223_372_036_854_775_807i64

Source§

const RANGE: Self = 9_223_372_036_854_775_807i64

Source§

impl DefaultRange for isize

Source§

const MIN_RANGE: Self = 0isize

Source§

const HALF_RANGE: Self = 1_073_741_823isize

Source§

const MAX_RANGE: Self = 2_147_483_647isize

Source§

const RANGE: Self = 2_147_483_647isize

Source§

impl DefaultRange for u8

Source§

const MIN_RANGE: Self = 0u8

Source§

const HALF_RANGE: Self = 127u8

Source§

const MAX_RANGE: Self = 255u8

Source§

const RANGE: Self = 255u8

Source§

impl DefaultRange for u16

Source§

const MIN_RANGE: Self = 0u16

Source§

const HALF_RANGE: Self = 32_767u16

Source§

const MAX_RANGE: Self = 65_535u16

Source§

const RANGE: Self = 65_535u16

Source§

impl DefaultRange for u32

Source§

const MIN_RANGE: Self = 0u32

Source§

const HALF_RANGE: Self = 2_147_483_647u32

Source§

const MAX_RANGE: Self = 4_294_967_295u32

Source§

const RANGE: Self = 4_294_967_295u32

Source§

impl DefaultRange for u64

Source§

const MIN_RANGE: Self = 0u64

Source§

const HALF_RANGE: Self = 9_223_372_036_854_775_807u64

Source§

const MAX_RANGE: Self = 18_446_744_073_709_551_615u64

Source§

const RANGE: Self = 18_446_744_073_709_551_615u64

Source§

impl DefaultRange for usize

Source§

const MIN_RANGE: Self = 0usize

Source§

const HALF_RANGE: Self = 2_147_483_647usize

Source§

const MAX_RANGE: Self = 4_294_967_295usize

Source§

const RANGE: Self = 4_294_967_295usize

Implementors§