Trait GenericScalar

Source
pub trait GenericScalar{
    type BitsType: Hash + Eq + Ord + Display + Debug;

    const ZERO: Self;
    const ONE: Self;
    const TWO: Self;
    const THREE: Self;
    const INFINITY: Self;
    const NEG_INFINITY: Self;
    const EPSILON: Self;

    // Required methods
    fn to_bits(self) -> Self::BitsType;
    fn from_bits(bits: Self::BitsType) -> Self;
    fn clamp(self, min: Self, max: Self) -> Self;
}
Expand description

A trait meant to to represent f32 or f64

Required Associated Constants§

Source

const ZERO: Self

Source

const ONE: Self

Source

const TWO: Self

Source

const THREE: Self

Source

const INFINITY: Self

Source

const NEG_INFINITY: Self

Source

const EPSILON: Self

Required Associated Types§

Source

type BitsType: Hash + Eq + Ord + Display + Debug

The type of the to_bits() and from_bits() methods

Required Methods§

Source

fn to_bits(self) -> Self::BitsType

Source

fn from_bits(bits: Self::BitsType) -> Self

Source

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

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

Source§

const ZERO: Self = 0f32

Source§

const ONE: Self = 1f32

Source§

const TWO: Self = 2f32

Source§

const THREE: Self = 3f32

Source§

const INFINITY: Self = +Inf_f32

Source§

const NEG_INFINITY: Self = -Inf_f32

Source§

const EPSILON: Self = 1.1920929E-7f32

Source§

type BitsType = u32

Source§

fn to_bits(self) -> Self::BitsType

Source§

fn from_bits(bits: Self::BitsType) -> Self

Source§

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

Source§

impl GenericScalar for f64

Source§

const ZERO: Self = 0f64

Source§

const ONE: Self = 1f64

Source§

const TWO: Self = 2f64

Source§

const THREE: Self = 3f64

Source§

const INFINITY: Self = +Inf_f64

Source§

const NEG_INFINITY: Self = -Inf_f64

Source§

const EPSILON: Self = 2.2204460492503131E-16f64

Source§

type BitsType = u64

Source§

fn to_bits(self) -> Self::BitsType

Source§

fn from_bits(bits: Self::BitsType) -> Self

Source§

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

Implementors§