pub struct SubtitleTrack {
pub entries: Vec<SubtitleEntry>,
pub language: Option<String>,
pub default_style: Option<SubtitleStyle>,
}Expand description
A collection of subtitle entries.
Fields§
§entries: Vec<SubtitleEntry>Subtitle entries sorted by time.
language: Option<String>Track language (BCP 47 tag).
default_style: Option<SubtitleStyle>Default style for all entries (can be overridden per entry).
Implementations§
Source§impl SubtitleTrack
impl SubtitleTrack
Sourcepub fn add(self, range: TimeRange, text: impl Into<String>) -> Self
pub fn add(self, range: TimeRange, text: impl Into<String>) -> Self
Add a subtitle entry (builder pattern).
Sourcepub fn with_language(self, lang: impl Into<String>) -> Self
pub fn with_language(self, lang: impl Into<String>) -> Self
Set the track language.
Sourcepub fn from_srt(content: &str) -> AppResult<Self>
pub fn from_srt(content: &str) -> AppResult<Self>
Parse SRT format subtitle content.
Handles common malformations:
- Extra blank lines between entries
- Windows (
\r\n) and Unix (\n) line endings - Missing or non-numeric sequence numbers
- BOM markers
Trait Implementations§
Source§impl Clone for SubtitleTrack
impl Clone for SubtitleTrack
Source§fn clone(&self) -> SubtitleTrack
fn clone(&self) -> SubtitleTrack
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 SubtitleTrack
impl Debug for SubtitleTrack
Source§impl Default for SubtitleTrack
impl Default for SubtitleTrack
Source§impl<'de> Deserialize<'de> for SubtitleTrack
impl<'de> Deserialize<'de> for SubtitleTrack
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SubtitleTrack
impl RefUnwindSafe for SubtitleTrack
impl Send for SubtitleTrack
impl Sync for SubtitleTrack
impl Unpin for SubtitleTrack
impl UnsafeUnpin for SubtitleTrack
impl UnwindSafe for SubtitleTrack
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