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