pub trait FromRatio<T> {
// Required method
fn from_ratio(numerator: T, denominator: T) -> Self;
// Provided method
fn from_ratios<const N: usize>(
numerators: [T; N],
denominator: T,
) -> [Self; N]
where T: Copy,
Self: Sized { ... }
}Expand description
Construct a value from the ratio of two raw values.
Division rounds toward zero. For Q<T, A, F>, the denominator must be
nonzero, the result must fit T, and the operand scaled by 2^|F| must
fit A: the numerator for positive F, the denominator for negative F.
Required Methods§
Sourcefn from_ratio(numerator: T, denominator: T) -> Self
fn from_ratio(numerator: T, denominator: T) -> Self
Return numerator / denominator in Self’s representation.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".