pub struct FrameRate { /* private fields */ }Expand description
A frame rate in frames per second, as the fraction
numerator / denominator.
Equality and hashing compare the rate: 30/1 and 60/2 are equal.
The supplied numerator and denominator are preserved by the accessors and
when submitted to the SDK. Compare both components explicitly when their
exact representation matters.
§Examples
use grafton_ndi::FrameRate;
// NTSC: 29.97 frames per second.
let ntsc = FrameRate::new(30_000, 1_001)?;
assert_eq!((ntsc.numerator(), ntsc.denominator()), (30_000, 1_001));
assert!(FrameRate::new(30, 0).is_err());Implementations§
Source§impl FrameRate
impl FrameRate
Sourcepub fn new(numerator: u32, denominator: u32) -> Result<Self>
pub fn new(numerator: u32, denominator: u32) -> Result<Self>
A frame rate of numerator / denominator frames per second.
§Errors
Error::InvalidInput unless both parts are in 1..=i32::MAX, the
range the SDK can carry.
Sourcepub const fn numerator(self) -> u32
pub const fn numerator(self) -> u32
The number of frames in denominator seconds.
Sourcepub const fn denominator(self) -> u32
pub const fn denominator(self) -> u32
The number of seconds that numerator frames take.
Trait Implementations§
impl Copy for FrameRate
impl Eq for FrameRate
Auto Trait Implementations§
impl Freeze 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