pub struct ChapterInfo { /* private fields */ }Expand description
Information about a chapter within a media file.
Chapters are discrete, named segments within a container (e.g., a chapter in an audiobook or a scene in a movie). Each chapter has a start and end time, and optionally a title and other metadata tags.
§Construction
Use ChapterInfo::builder() for fluent construction:
use ff_format::chapter::ChapterInfo;
use std::time::Duration;
let chapter = ChapterInfo::builder()
.id(0)
.title("Intro")
.start(Duration::ZERO)
.end(Duration::from_secs(30))
.build();Implementations§
Source§impl ChapterInfo
impl ChapterInfo
Sourcepub fn builder() -> ChapterInfoBuilder
pub fn builder() -> ChapterInfoBuilder
Creates a new builder for constructing ChapterInfo.
Sourcepub fn metadata(&self) -> Option<&HashMap<String, String>>
pub fn metadata(&self) -> Option<&HashMap<String, String>>
Returns the chapter metadata tags (excluding “title”), if any.
Sourcepub fn duration(&self) -> Duration
pub fn duration(&self) -> Duration
Returns the chapter duration (end − start).
Uses saturating subtraction so that malformed chapters where end < start
return Duration::ZERO instead of panicking.
Trait Implementations§
Source§impl Clone for ChapterInfo
impl Clone for ChapterInfo
Source§fn clone(&self) -> ChapterInfo
fn clone(&self) -> ChapterInfo
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 ChapterInfo
impl Debug for ChapterInfo
Source§impl Default for ChapterInfo
impl Default for ChapterInfo
Source§fn default() -> ChapterInfo
fn default() -> ChapterInfo
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ChapterInfo
impl RefUnwindSafe for ChapterInfo
impl Send for ChapterInfo
impl Sync for ChapterInfo
impl Unpin for ChapterInfo
impl UnsafeUnpin for ChapterInfo
impl UnwindSafe for ChapterInfo
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