Trait NumberOps

Source
pub trait NumberOps<T: Number> {
    // Required methods
    fn min(a: Self, b: Self) -> Self;
    fn max(a: Self, b: Self) -> Self;
    fn clamp(x: Self, min: Self, max: Self) -> Self;
    fn step(a: Self, b: Self) -> Self;
}
Expand description

operations applicable to both floating point, integer and unsigned types

Required Methods§

Source

fn min(a: Self, b: Self) -> Self

returns the minimum value of a and b

Source

fn max(a: Self, b: Self) -> Self

returns the maximum value of a and b

Source

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

returns value x clamped to the range min - max

Source

fn step(a: Self, b: Self) -> Self

returns a vector stepped component wise; 1 if a is >= b, 0 otherwise

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

Source§

fn min(a: Self, b: Self) -> Self

Source§

fn max(a: Self, b: Self) -> Self

Source§

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

Source§

fn step(a: Self, b: Self) -> Self

Source§

impl NumberOps<f64> for f64

Source§

fn min(a: Self, b: Self) -> Self

Source§

fn max(a: Self, b: Self) -> Self

Source§

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

Source§

fn step(a: Self, b: Self) -> Self

Source§

impl NumberOps<i8> for i8

Source§

fn min(a: Self, b: Self) -> Self

Source§

fn max(a: Self, b: Self) -> Self

Source§

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

Source§

fn step(a: Self, b: Self) -> Self

Source§

impl NumberOps<i16> for i16

Source§

fn min(a: Self, b: Self) -> Self

Source§

fn max(a: Self, b: Self) -> Self

Source§

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

Source§

fn step(a: Self, b: Self) -> Self

Source§

impl NumberOps<i32> for i32

Source§

fn min(a: Self, b: Self) -> Self

Source§

fn max(a: Self, b: Self) -> Self

Source§

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

Source§

fn step(a: Self, b: Self) -> Self

Source§

impl NumberOps<i64> for i64

Source§

fn min(a: Self, b: Self) -> Self

Source§

fn max(a: Self, b: Self) -> Self

Source§

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

Source§

fn step(a: Self, b: Self) -> Self

Source§

impl NumberOps<isize> for isize

Source§

fn min(a: Self, b: Self) -> Self

Source§

fn max(a: Self, b: Self) -> Self

Source§

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

Source§

fn step(a: Self, b: Self) -> Self

Source§

impl NumberOps<u8> for u8

Source§

fn min(a: Self, b: Self) -> Self

Source§

fn max(a: Self, b: Self) -> Self

Source§

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

Source§

fn step(a: Self, b: Self) -> Self

Source§

impl NumberOps<u16> for u16

Source§

fn min(a: Self, b: Self) -> Self

Source§

fn max(a: Self, b: Self) -> Self

Source§

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

Source§

fn step(a: Self, b: Self) -> Self

Source§

impl NumberOps<u32> for u32

Source§

fn min(a: Self, b: Self) -> Self

Source§

fn max(a: Self, b: Self) -> Self

Source§

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

Source§

fn step(a: Self, b: Self) -> Self

Source§

impl NumberOps<u64> for u64

Source§

fn min(a: Self, b: Self) -> Self

Source§

fn max(a: Self, b: Self) -> Self

Source§

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

Source§

fn step(a: Self, b: Self) -> Self

Source§

impl NumberOps<usize> for usize

Source§

fn min(a: Self, b: Self) -> Self

Source§

fn max(a: Self, b: Self) -> Self

Source§

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

Source§

fn step(a: Self, b: Self) -> Self

Implementors§

Source§

impl<T> NumberOps<T> for Vec2<T>
where T: Number + NumberOps<T>,

Source§

impl<T> NumberOps<T> for Vec3<T>
where T: Number + NumberOps<T>,

Source§

impl<T> NumberOps<T> for Vec4<T>
where T: Number + NumberOps<T>,