pub struct TimecodeRange {
pub start: u64,
pub end: u64,
}Expand description
A range defined by a start frame and an end frame (inclusive).
Fields§
§start: u64Start frame (inclusive).
end: u64End frame (inclusive).
Implementations§
Source§impl TimecodeRange
impl TimecodeRange
Sourcepub fn new(start: u64, end: u64) -> Option<Self>
pub fn new(start: u64, end: u64) -> Option<Self>
Create a new TimecodeRange.
Returns None if end < start.
Sourcepub fn duration_frames(&self) -> u64
pub fn duration_frames(&self) -> u64
Number of frames contained in this range (inclusive on both ends).
Sourcepub fn contains_frame(&self, frame: u64) -> bool
pub fn contains_frame(&self, frame: u64) -> bool
Whether frame is within [start, end].
Sourcepub fn overlaps(&self, other: &TimecodeRange) -> bool
pub fn overlaps(&self, other: &TimecodeRange) -> bool
Whether this range overlaps with other.
Sourcepub fn split_at(&self, frame: u64) -> Option<(TimecodeRange, TimecodeRange)>
pub fn split_at(&self, frame: u64) -> Option<(TimecodeRange, TimecodeRange)>
Split this range at frame, returning two sub-ranges.
The split point becomes the last frame of the first range and the
first frame of the second. Returns None if frame is outside
[start, end - 1] (there must be at least one frame on each side).
Trait Implementations§
Source§impl Clone for TimecodeRange
impl Clone for TimecodeRange
Source§fn clone(&self) -> TimecodeRange
fn clone(&self) -> TimecodeRange
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 TimecodeRange
impl Debug for TimecodeRange
Source§impl PartialEq for TimecodeRange
impl PartialEq for TimecodeRange
impl Copy for TimecodeRange
impl Eq for TimecodeRange
impl StructuralPartialEq for TimecodeRange
Auto Trait Implementations§
impl Freeze for TimecodeRange
impl RefUnwindSafe for TimecodeRange
impl Send for TimecodeRange
impl Sync for TimecodeRange
impl Unpin for TimecodeRange
impl UnsafeUnpin for TimecodeRange
impl UnwindSafe for TimecodeRange
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