pub struct TcCalculator { /* private fields */ }Expand description
Performs timecode arithmetic with drop-frame awareness.
§Example
use oximedia_timecode::{Timecode, FrameRate};
use oximedia_timecode::tc_calculator::{TcCalculator, TcOperation};
let calc = TcCalculator::new(FrameRate::Fps25);
let tc = Timecode::new(0, 0, 0, 0, FrameRate::Fps25)?;
let result = calc.apply(&tc, TcOperation::AddFrames(50))?;
assert_eq!(result.timecode.seconds, 2);Implementations§
Source§impl TcCalculator
impl TcCalculator
Sourcepub fn frames_per_day(&self) -> u64
pub fn frames_per_day(&self) -> u64
Total number of frames in a 24-hour day for this frame rate.
Sourcepub fn apply(
&self,
tc: &Timecode,
op: TcOperation,
) -> Result<TcResult, TimecodeError>
pub fn apply( &self, tc: &Timecode, op: TcOperation, ) -> Result<TcResult, TimecodeError>
Apply an operation to a timecode.
Sourcepub fn difference(&self, a: &Timecode, b: &Timecode) -> i64
pub fn difference(&self, a: &Timecode, b: &Timecode) -> i64
Compute the signed frame difference b - a.
Positive means b is later; negative means b is earlier (wrap is ignored).
Trait Implementations§
Source§impl Clone for TcCalculator
impl Clone for TcCalculator
Source§fn clone(&self) -> TcCalculator
fn clone(&self) -> TcCalculator
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 TcCalculator
impl Debug for TcCalculator
impl Copy for TcCalculator
Auto Trait Implementations§
impl Freeze for TcCalculator
impl RefUnwindSafe for TcCalculator
impl Send for TcCalculator
impl Sync for TcCalculator
impl Unpin for TcCalculator
impl UnsafeUnpin for TcCalculator
impl UnwindSafe for TcCalculator
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