pub trait NumericOps:
Copy
+ Clone
+ PartialOrd
+ PartialEq {
// Required methods
fn checked_add(&self, other: Self) -> Option<Self>;
fn checked_sub(&self, other: Self) -> Option<Self>;
fn checked_mul(&self, other: Self) -> Option<Self>;
fn checked_div(&self, other: Self) -> Option<Self>;
fn checked_rem(&self, other: Self) -> Option<Self>;
fn saturating_add(&self, other: Self) -> Self;
fn saturating_sub(&self, other: Self) -> Self;
fn saturating_mul(&self, other: Self) -> Self;
fn round_2dp(self) -> Self;
fn zero() -> Self;
fn is_sign_positive(&self) -> bool;
fn is_sign_negative(&self) -> bool;
}Expand description
Helper trait for numeric operations that work across both Decimal and f64
Required Methods§
fn checked_add(&self, other: Self) -> Option<Self>
fn checked_sub(&self, other: Self) -> Option<Self>
fn checked_mul(&self, other: Self) -> Option<Self>
fn checked_div(&self, other: Self) -> Option<Self>
fn checked_rem(&self, other: Self) -> Option<Self>
fn saturating_add(&self, other: Self) -> Self
fn saturating_sub(&self, other: Self) -> Self
fn saturating_mul(&self, other: Self) -> Self
fn round_2dp(self) -> Self
fn zero() -> Self
fn is_sign_positive(&self) -> bool
fn is_sign_negative(&self) -> bool
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.