Trait vector2math::Scalar

source ·
pub trait Scalar: Add<Self, Output = Self> + Copy + PartialEq + PartialOrd + Sub<Self, Output = Self> + Mul<Self, Output = Self> + Div<Self, Output = Self> {
    const ZERO: Self;
    const ONE: Self;
    const TWO: Self;

    // Required method
    fn abs(self) -> Self;

    // Provided methods
    fn maxx(self, other: Self) -> Self { ... }
    fn minn(self, other: Self) -> Self { ... }
}
Expand description

Trait for math with scalar numbers

Required Associated Constants§

source

const ZERO: Self

The value of 0

source

const ONE: Self

The value of 1

source

const TWO: Self

The value of 2

Required Methods§

source

fn abs(self) -> Self

Get the absolute value of the number

Provided Methods§

source

fn maxx(self, other: Self) -> Self

Get the max of this Scalar and another

This function is named to not conflict with the Scalar’s default max function

source

fn minn(self, other: Self) -> Self

Get the min of this Scalar and another

This function is named to not conflict with the Scalar’s default min function

Implementations on Foreign Types§

source§

impl Scalar for f64

source§

const ZERO: Self = 0f64

source§

const ONE: Self = 1f64

source§

const TWO: Self = 2f64

source§

fn abs(self) -> Self

source§

impl Scalar for i8

source§

const ZERO: Self = 0i8

source§

const ONE: Self = 1i8

source§

const TWO: Self = 2i8

source§

fn abs(self) -> Self

source§

impl Scalar for i128

source§

const ZERO: Self = 0i128

source§

const ONE: Self = 1i128

source§

const TWO: Self = 2i128

source§

fn abs(self) -> Self

source§

impl Scalar for isize

source§

const ZERO: Self = 0isize

source§

const ONE: Self = 1isize

source§

const TWO: Self = 2isize

source§

fn abs(self) -> Self

source§

impl Scalar for u128

source§

const ZERO: Self = 0u128

source§

const ONE: Self = 1u128

source§

const TWO: Self = 2u128

source§

fn abs(self) -> Self

source§

impl Scalar for f32

source§

const ZERO: Self = 0f32

source§

const ONE: Self = 1f32

source§

const TWO: Self = 2f32

source§

fn abs(self) -> Self

source§

impl Scalar for i64

source§

const ZERO: Self = 0i64

source§

const ONE: Self = 1i64

source§

const TWO: Self = 2i64

source§

fn abs(self) -> Self

source§

impl Scalar for i32

source§

const ZERO: Self = 0i32

source§

const ONE: Self = 1i32

source§

const TWO: Self = 2i32

source§

fn abs(self) -> Self

source§

impl Scalar for u8

source§

const ZERO: Self = 0u8

source§

const ONE: Self = 1u8

source§

const TWO: Self = 2u8

source§

fn abs(self) -> Self

source§

impl Scalar for u64

source§

const ZERO: Self = 0u64

source§

const ONE: Self = 1u64

source§

const TWO: Self = 2u64

source§

fn abs(self) -> Self

source§

impl Scalar for i16

source§

const ZERO: Self = 0i16

source§

const ONE: Self = 1i16

source§

const TWO: Self = 2i16

source§

fn abs(self) -> Self

source§

impl Scalar for usize

source§

const ZERO: Self = 0usize

source§

const ONE: Self = 1usize

source§

const TWO: Self = 2usize

source§

fn abs(self) -> Self

source§

impl Scalar for u16

source§

const ZERO: Self = 0u16

source§

const ONE: Self = 1u16

source§

const TWO: Self = 2u16

source§

fn abs(self) -> Self

source§

impl Scalar for u32

source§

const ZERO: Self = 0u32

source§

const ONE: Self = 1u32

source§

const TWO: Self = 2u32

source§

fn abs(self) -> Self

Implementors§