pub trait Num:
Default
+ PartialEq
+ PartialOrd
+ Copy
+ AddAssign
+ MulAssign
+ SubAssign
+ DivAssign
+ Add<Output = Self>
+ Mul<Output = Self>
+ Sub<Output = Self>
+ Div<Output = Self> {
// Required methods
fn zero() -> Self;
fn one() -> Self;
fn two() -> Self;
fn four() -> Self;
fn get_max(self, b: Self) -> Self;
fn get_min(self, b: Self) -> Self;
fn saturating_sub(self, rhs: Self) -> Self;
fn saturating_add(self, rhs: Self) -> Self;
fn from_f32(value: f32) -> Self;
fn to_f32(self) -> f32;
fn round_up(self) -> Self;
fn round_down(self) -> Self;
}Expand description
A Number trait. Automatically implemented for primitive number types (i32, f32, etc).
Required Methods§
fn zero() -> Self
fn one() -> Self
fn two() -> Self
fn four() -> Self
fn get_max(self, b: Self) -> Self
fn get_min(self, b: Self) -> Self
fn saturating_sub(self, rhs: Self) -> Self
fn saturating_add(self, rhs: Self) -> Self
fn from_f32(value: f32) -> Self
fn to_f32(self) -> f32
fn round_up(self) -> Self
fn round_down(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.