pub struct TcDuration {
pub frames: i64,
pub frame_rate_num: u32,
pub frame_rate_den: u32,
}Expand description
A duration expressed as a frame count at a given frame rate
Fields§
§frames: i64Signed frame count (negative = before reference point)
frame_rate_num: u32Frame rate numerator
frame_rate_den: u32Frame rate denominator
Implementations§
Source§impl TcDuration
impl TcDuration
Sourcepub fn new(frames: i64, frame_rate_num: u32, frame_rate_den: u32) -> Self
pub fn new(frames: i64, frame_rate_num: u32, frame_rate_den: u32) -> Self
Create a new TcDuration
Sourcepub fn to_seconds(&self) -> f64
pub fn to_seconds(&self) -> f64
Convert to floating-point seconds
Sourcepub fn to_milliseconds(&self) -> f64
pub fn to_milliseconds(&self) -> f64
Convert to milliseconds
Sourcepub fn add(&self, other: &TcDuration) -> TcDuration
pub fn add(&self, other: &TcDuration) -> TcDuration
Add two durations (must share the same frame rate)
Sourcepub fn subtract(&self, other: &TcDuration) -> Option<TcDuration>
pub fn subtract(&self, other: &TcDuration) -> Option<TcDuration>
Subtract other from self. Returns None if the result would be negative.
Sourcepub fn is_negative(&self) -> bool
pub fn is_negative(&self) -> bool
Returns true when the frame count is negative
Trait Implementations§
Source§impl Clone for TcDuration
impl Clone for TcDuration
Source§fn clone(&self) -> TcDuration
fn clone(&self) -> TcDuration
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TcDuration
impl Debug for TcDuration
Source§impl PartialEq for TcDuration
impl PartialEq for TcDuration
impl Copy for TcDuration
impl Eq for TcDuration
impl StructuralPartialEq for TcDuration
Auto Trait Implementations§
impl Freeze for TcDuration
impl RefUnwindSafe for TcDuration
impl Send for TcDuration
impl Sync for TcDuration
impl Unpin for TcDuration
impl UnsafeUnpin for TcDuration
impl UnwindSafe for TcDuration
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