pub struct FrameRate { /* private fields */ }Expand description
A positive rational number of frames per second, stored in reduced form.
Implementations§
Source§impl FrameRate
impl FrameRate
Sourcepub const NTSC_DOUBLE: Self
pub const NTSC_DOUBLE: Self
Double NTSC rate of exactly 60000/1001 frames per second.
Sourcepub fn try_new(
numerator: u32,
denominator: u32,
) -> Result<Self, ValidationError>
pub fn try_new( numerator: u32, denominator: u32, ) -> Result<Self, ValidationError>
Constructs and reduces a rational frame rate from runtime components.
§Errors
Returns an error when either component is zero.
Sourcepub const fn new(numerator: NonZeroU32, denominator: NonZeroU32) -> Self
pub const fn new(numerator: NonZeroU32, denominator: NonZeroU32) -> Self
Constructs and reduces a rational frame rate.
Sourcepub const fn per_second(frames: NonZeroU32) -> Self
pub const fn per_second(frames: NonZeroU32) -> Self
Constructs a rate of whole frames per second; see also fps!.
Sourcepub const fn denominator(self) -> u32
pub const fn denominator(self) -> u32
Returns the denominator of the reduced rate.
Sourcepub fn frame_duration(self) -> Duration
pub fn frame_duration(self) -> Duration
Returns the first frame’s duration, rounded up if not tick-exact.
Use Time::from_frame for later boundaries to avoid accumulated rounding.
Trait Implementations§
impl Copy for FrameRate
impl Eq for FrameRate
Source§impl From<NonZero<u32>> for FrameRate
impl From<NonZero<u32>> for FrameRate
Source§fn from(frames_per_second: NonZeroU32) -> Self
fn from(frames_per_second: NonZeroU32) -> Self
Converts to this type from the input type.
impl StructuralPartialEq for FrameRate
Auto Trait Implementations§
impl Forget for FrameRate
impl Freeze for FrameRate
impl Move for FrameRate
impl RefUnwindSafe for FrameRate
impl Send for FrameRate
impl Sync for FrameRate
impl Unpin for FrameRate
impl UnsafeUnpin for FrameRate
impl UnwindSafe for FrameRate
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