pub struct Time {
pub hours: u8,
pub minutes: u8,
pub seconds: u8,
pub frames: u8,
}Expand description
A time code: hours, minutes, seconds and frames.
Time codes are ordered by hours, minutes, seconds and frames.
Fields§
§hours: u8Hours, 0-23 in Time Code In and Out
minutes: u8Minutes, 0-59
seconds: u8Seconds, 0-59
frames: u8Frames, less than the number of frames per second
Implementations§
Source§impl Time
impl Time
Sourcepub fn format_fps(&self, fps: usize) -> String
pub fn format_fps(&self, fps: usize) -> String
Formats the time as H:M:S,ms, with the frames converted to milliseconds at fps
frames per second.
§Example
use ebustl_parser::Time;
let time = Time { hours: 1, minutes: 2, seconds: 3, frames: 12 };
assert_eq!("1:2:3,480", time.format_fps(25));Sourcepub fn is_valid(&self, fps: usize) -> bool
pub fn is_valid(&self, fps: usize) -> bool
Returns true if each element is in the range the spec gives for Time Code In and Out:
hours 0-23, minutes and seconds 0-59 and frames less than fps.
§Example
use ebustl_parser::Time;
let time = Time { hours: 10, minutes: 0, seconds: 0, frames: 29 };
assert!(time.is_valid(30));
assert!(!time.is_valid(25));Trait Implementations§
impl Copy for Time
impl Eq for Time
Source§impl Ord for Time
impl Ord for Time
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Time
impl PartialOrd for Time
impl StructuralPartialEq for Time
Auto Trait Implementations§
impl Freeze for Time
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnsafeUnpin for Time
impl UnwindSafe for Time
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