num_opt::my_float

Trait MyFloat

Source
pub trait MyFloat:
    Clone
    + Debug
    + Display
    + Add<Output = Self>
    + AddAssign<Fpt>
    + AddAssign<Self>
    + Pow<i32, Output = Self>
    + Add<Output = Self>
    + Mul<Self, Output = Self>
    + Mul<Fpt, Output = Self>
    + Sub<Output = Self>
    + Sub<Fpt, Output = Self>
    + Div<Output = Self>
    + DivAssign<Fpt>
    + Neg<Output = Self>
    + PartialEq<Fpt>
    + PartialOrd<Fpt>
    + PartialOrd<Self>
    + Send
    + Sync {
Show 17 methods // Required methods fn precision() -> u32; fn from_f(f: Fpt) -> Self; fn from_f_fraction(n: Fpt, d: Fpt) -> Self; fn to_f(&self) -> Fpt; fn floor(&self) -> Self; fn sqrt(&self) -> Self; fn max(&self, other: &Self) -> Self; fn min(&self, other: &Self) -> Self; fn clamp(&self, min: Fpt, max: Fpt) -> Self; fn sin(&self) -> Self; fn cos(&self) -> Self; fn acos(&self) -> Self; fn atan2(&self, other: &Self) -> Self; fn is_nan(&self) -> bool; fn abs(&self) -> Self; fn one() -> Self; fn zero() -> Self;
}
Expand description

Generic float type that doesn’t need to be Copy

Required Methods§

Source

fn precision() -> u32

Source

fn from_f(f: Fpt) -> Self

Source

fn from_f_fraction(n: Fpt, d: Fpt) -> Self

Source

fn to_f(&self) -> Fpt

Source

fn floor(&self) -> Self

Source

fn sqrt(&self) -> Self

Source

fn max(&self, other: &Self) -> Self

Source

fn min(&self, other: &Self) -> Self

Source

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

Source

fn sin(&self) -> Self

Source

fn cos(&self) -> Self

Source

fn acos(&self) -> Self

Source

fn atan2(&self, other: &Self) -> Self

Source

fn is_nan(&self) -> bool

Source

fn abs(&self) -> Self

Source

fn one() -> Self

Source

fn zero() -> 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 MyFloat for Float

Source§

fn precision() -> u32

Source§

fn from_f(f: Fpt) -> Self

Source§

fn from_f_fraction(n: Fpt, d: Fpt) -> Self

Source§

fn to_f(&self) -> Fpt

Source§

fn floor(&self) -> Self

Source§

fn sqrt(&self) -> Self

Source§

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

Source§

fn sin(&self) -> Self

Source§

fn cos(&self) -> Self

Source§

fn acos(&self) -> Self

Source§

fn is_nan(&self) -> bool

Source§

fn max(&self, other: &Self) -> Self

Source§

fn min(&self, other: &Self) -> Self

Source§

fn abs(&self) -> Self

Source§

fn one() -> Self

Source§

fn zero() -> Self

Source§

fn atan2(&self, other: &Self) -> Self

Implementors§