pub trait FloatLike:
Copy
+ Display
+ Debug
+ PartialOrd
+ PartialEq
+ Add<Output = Self>
+ Sub<Output = Self>
+ Mul<Output = Self>
+ Div<Output = Self>
+ Neg<Output = Self>
+ Sum<Self>
+ Product<Self>
+ SubAssign
+ AddAssign
+ MulAssign {
const MAX: Self;
Show 13 methods
// Required methods
fn zero() -> Self;
fn one() -> Self;
fn powf(self, n: Self) -> Self;
fn abs(&self) -> Self;
fn min(self, other: Self) -> Self;
fn max(self, other: Self) -> Self;
fn from_u16(n: u16) -> Self;
fn from_usize(n: usize) -> Self;
fn from_i32(n: i32) -> Self;
fn from_f32(n: f32) -> Self;
fn round_with_mode(
&self,
dp: u32,
mode: RoundingMode,
epsilon: Self,
) -> Self;
// Provided methods
fn two() -> Self { ... }
fn is_zero(&self) -> bool { ... }
}
Expand description
The FloatLike trait is designed to abstract over any fractional numeric type. By default,
it supports f32, f64, and rust_decimal
’s Decimal. This allows for the generic implementation of
the mathematical operations supported by this library.
Required Associated Constants§
Required Methods§
fn zero() -> Self
fn one() -> Self
fn powf(self, n: Self) -> Self
fn abs(&self) -> Self
fn min(self, other: Self) -> Self
fn max(self, other: Self) -> Self
fn from_u16(n: u16) -> Self
fn from_usize(n: usize) -> Self
fn from_i32(n: i32) -> Self
fn from_f32(n: f32) -> Self
fn round_with_mode(&self, dp: u32, mode: RoundingMode, epsilon: Self) -> Self
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.