pub trait SafeNumeric:
Copy
+ PartialOrd
+ Sized {
// Required methods
fn max() -> Self;
fn min() -> Self;
fn safe_add(self, rhs: Self) -> Self;
fn safe_sub(self, rhs: Self) -> Self;
fn safe_mul(self, rhs: Self) -> Self;
fn safe_div(self, rhs: Self) -> Self;
}
Expand description
A trait for safe arithmetic operations with bound checks.
Required Methods§
fn max() -> Self
fn min() -> Self
fn safe_add(self, rhs: Self) -> Self
fn safe_sub(self, rhs: Self) -> Self
fn safe_mul(self, rhs: Self) -> Self
fn safe_div(self, rhs: 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.