pub trait FixedPoint: Sized {
// Required methods
fn fixed_mul_floor(self, y: Self, denominator: Self) -> Option<Self>;
fn fixed_mul_ceil(self, y: Self, denominator: Self) -> Option<Self>;
fn fixed_div_floor(self, y: Self, denominator: Self) -> Option<Self>;
fn fixed_div_ceil(self, y: Self, denominator: Self) -> Option<Self>;
}
Expand description
Fixed point trait for computing fixed point calculations with native rust types.
Required Methods§
Sourcefn fixed_mul_floor(self, y: Self, denominator: Self) -> Option<Self>
fn fixed_mul_floor(self, y: Self, denominator: Self) -> Option<Self>
Safely calculates floor(x * y / denominator). Returns None if a phantom overflow occurs or if the denominator is 0.
Sourcefn fixed_mul_ceil(self, y: Self, denominator: Self) -> Option<Self>
fn fixed_mul_ceil(self, y: Self, denominator: Self) -> Option<Self>
Safely calculates ceil(x * y / denominator). Returns None if a phantom overflow occurs or if the denominator is 0.
Sourcefn fixed_div_floor(self, y: Self, denominator: Self) -> Option<Self>
fn fixed_div_floor(self, y: Self, denominator: Self) -> Option<Self>
Safely calculates floor(x * denominator / y). Returns None if a phantom overflow occurs or if the denominator is 0.
Sourcefn fixed_div_ceil(self, y: Self, denominator: Self) -> Option<Self>
fn fixed_div_ceil(self, y: Self, denominator: Self) -> Option<Self>
Safely calculates ceil(x * denominator / y). Returns None if a phantom overflow occurs or if the denominator is 0.
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.