pub struct Ratio { /* private fields */ }Expand description
An exact non-negative rational number, always stored in lowest terms.
Seconds, frame rates, sample rates and pull factors are ratios so that NTSC rates such as 30000/1001 frames per second never pick up floating-point error.
Implementations§
Source§impl Ratio
impl Ratio
Sourcepub const fn from_integer(value: u64) -> Self
pub const fn from_integer(value: u64) -> Self
Creates the whole number value.
Sourcepub const fn checked_mul(self, rhs: Self) -> Option<Self>
pub const fn checked_mul(self, rhs: Self) -> Option<Self>
Multiplies two ratios, or returns None when the reduced result does not fit in u64.
Trait Implementations§
impl Copy for Ratio
impl Eq for Ratio
Source§impl Ord for Ratio
impl Ord for Ratio
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Ratio
impl PartialOrd for Ratio
impl StructuralPartialEq for Ratio
Auto Trait Implementations§
impl Freeze for Ratio
impl RefUnwindSafe for Ratio
impl Send for Ratio
impl Sync for Ratio
impl Unpin for Ratio
impl UnsafeUnpin for Ratio
impl UnwindSafe for Ratio
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more