pub struct Timecode {
pub hours: u8,
pub minutes: u8,
pub seconds: u8,
pub frames: u8,
pub format: TimecodeFormat,
}Expand description
A timecode value.
Fields§
§hours: u8Hours (0-23).
minutes: u8Minutes (0-59).
seconds: u8Seconds (0-59).
frames: u8Frames (0-fps-1).
format: TimecodeFormatFormat.
Implementations§
Source§impl Timecode
impl Timecode
Sourcepub fn new(
hours: u8,
minutes: u8,
seconds: u8,
frames: u8,
format: TimecodeFormat,
) -> OxiResult<Self>
pub fn new( hours: u8, minutes: u8, seconds: u8, frames: u8, format: TimecodeFormat, ) -> OxiResult<Self>
Creates a new timecode.
§Errors
Returns Err if hours >= 24, minutes >= 60, seconds >= 60, or frames >= fps.
Sourcepub fn from_frame_count(frame_count: u64, format: TimecodeFormat) -> Self
pub fn from_frame_count(frame_count: u64, format: TimecodeFormat) -> Self
Creates a timecode from frame count.
Sourcepub fn to_frame_count(&self) -> u64
pub fn to_frame_count(&self) -> u64
Converts timecode to frame count.
Sourcepub fn format_string(&self) -> String
pub fn format_string(&self) -> String
Formats the timecode as a string.
Sourcepub fn from_string(s: &str, format: TimecodeFormat) -> OxiResult<Self>
pub fn from_string(s: &str, format: TimecodeFormat) -> OxiResult<Self>
Parses a timecode string.
§Errors
Returns Err if the string is not in HH:MM:SS:FF format or contains invalid values.
Trait Implementations§
impl Copy for Timecode
impl Eq for Timecode
impl StructuralPartialEq for Timecode
Auto Trait Implementations§
impl Freeze for Timecode
impl RefUnwindSafe for Timecode
impl Send for Timecode
impl Sync for Timecode
impl Unpin for Timecode
impl UnsafeUnpin for Timecode
impl UnwindSafe for Timecode
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