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.
For positive F, Q<T, A, F> computes (numerator << F) / denominator in
A, then narrows to T. The denominator must be nonzero and the result must
fit T.
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".