pub trait Numeric:
Copy
+ Add<Output = Self>
+ Sub<Output = Self>
+ Mul<Output = Self>
+ Div<Output = Self>
+ Display
+ Debug
+ PartialEq
+ PartialOrd {
// Required methods
fn zero() -> Self;
fn one() -> Self;
fn f64(&self) -> f64;
fn f32(&self) -> f32;
fn from_u32(value: u32) -> Self;
// Provided method
fn from_f64(value: f64) -> Self
where Self: From<f64> { ... }
}Expand description
The Numeric trait defines a set of operations that numeric types must support.
It includes basic arithmetic operations and the ability to return special values like zero and one.
Types implementing Numeric can be used generically in contexts where arithmetic operations are required.
Required Methods§
Provided Methods§
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.