webvtt_parser

Struct OwnedVtt

Source
pub struct OwnedVtt {
    pub slugs: HashMap<String, String>,
    pub style: Option<String>,
    pub cues: Vec<OwnedVttCue>,
}
Expand description

(web)VTT — Web Video Text Tracks This struct represents a parsed VTT file. It contains a list of cues and optional metadata.

Make sure that this version is used when you need to own the data. If its possible please use the Vtt struct instead.

Fields§

§slugs: HashMap<String, String>

Top level key-value metadata pairs that might be populated at the very top of the subtitles file. For example:

WEBVTT
Kind: captions
Language: en
§style: Option<String>

Optional global css style can be populated at the very top of the file. If it is present it might be applied globally to all cues.

For example:

STYLE
::cue {
   background-image: linear-gradient(to bottom, dimgray, lightgray);
   color: papayawhip;
   font-size: 50px;
   text-align: center;
   font-family: monospace;
 }
§cues: Vec<OwnedVttCue>

A list of cues that are present in the file. Each cue contains a start and end time, text and optional cue settings.

For example:

WEBVTT
00:00.000 --> 00:05.000
Hey subtitle one

Implementations§

Source§

impl OwnedVtt

Source

pub fn parse(content: &str) -> Result<Self, VttError>

Trait Implementations§

Source§

impl Clone for OwnedVtt

Source§

fn clone(&self) -> OwnedVtt

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OwnedVtt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> From<&'a OwnedVtt> for Vtt<'a>

Source§

fn from(value: &'a OwnedVtt) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for OwnedVtt

Source§

fn eq(&self, other: &OwnedVtt) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ASubtitle for OwnedVtt

Source§

impl Eq for OwnedVtt

Source§

impl StructuralPartialEq for OwnedVtt

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.