pub struct TimeSpan {
pub start: TimePoint,
pub end: TimePoint,
}
Expand description
A time span (e.g. time in which a subtitle is shown).
Fields§
§start: TimePoint
Start of the time span.
end: TimePoint
End of the time span.
Implementations§
Source§impl TimeSpan
impl TimeSpan
Sourcepub fn new(start: TimePoint, end: TimePoint) -> TimeSpan
pub fn new(start: TimePoint, end: TimePoint) -> TimeSpan
Constructor of TimeSpan
s.
Examples found in repository?
examples/example2.rs (line 10)
6fn main() {
7 // example how to create a fresh .srt file
8 let lines = vec![
9 (
10 TimeSpan::new(TimePoint::from_msecs(1500), TimePoint::from_msecs(3700)),
11 "line1".to_string(),
12 ),
13 (
14 TimeSpan::new(TimePoint::from_msecs(4500), TimePoint::from_msecs(8700)),
15 "line2".to_string(),
16 ),
17 ];
18 let file = SrtFile::create(lines).unwrap();
19
20 // generate file content
21 let srt_string = String::from_utf8(file.to_data().unwrap()).unwrap();
22 println!("{}", srt_string);
23}
Trait Implementations§
Source§impl AddAssign<TimeDelta> for TimeSpan
impl AddAssign<TimeDelta> for TimeSpan
Source§fn add_assign(&mut self, r: TimeDelta)
fn add_assign(&mut self, r: TimeDelta)
Performs the
+=
operation. Read moreSource§impl From<TimeSpan> for SubtitleEntry
impl From<TimeSpan> for SubtitleEntry
Source§fn from(f: TimeSpan) -> SubtitleEntry
fn from(f: TimeSpan) -> SubtitleEntry
Converts to this type from the input type.
Source§impl Ord for TimeSpan
impl Ord for TimeSpan
Source§impl PartialOrd for TimeSpan
impl PartialOrd for TimeSpan
Source§impl SubAssign<TimeDelta> for TimeSpan
impl SubAssign<TimeDelta> for TimeSpan
Source§fn sub_assign(&mut self, r: TimeDelta)
fn sub_assign(&mut self, r: TimeDelta)
Performs the
-=
operation. Read moreimpl Copy for TimeSpan
impl Eq for TimeSpan
impl StructuralPartialEq for TimeSpan
Auto Trait Implementations§
impl Freeze for TimeSpan
impl RefUnwindSafe for TimeSpan
impl Send for TimeSpan
impl Sync for TimeSpan
impl Unpin for TimeSpan
impl UnwindSafe for TimeSpan
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