Trait maths_rs::num::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

Implementations on Foreign Types§

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

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

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>,