Struct TimeSpans

Source
pub struct TimeSpans(pub Vec<TimeSpan>);
Expand description

TimeSpan buffer to be used as reference by the synchronization process

May be generated from an AudioSink that’s been processed for voice- activity, extracted from a subtitle file whose timing is known to be good, or populated manually by some other process (e.g. extracing embedded subs from video file). TimeSpans also provides functionality for reading and writing raw timespan data to/from disk which is useful for caching.

Tuple Fields§

§0: Vec<TimeSpan>

Implementations§

Source§

impl TimeSpans

Source

pub fn push(&mut self, span: SubTimeSpan)

Appends a timespan

Source

pub fn save(&self, filename: &str) -> Result<(), TimeSpansSaveError>

Saves raw timespan data to disk

Source

pub fn load(filename: &str) -> Result<Self, TimeSpansLoadError>

Loads raw timespan data from disk

Source

pub fn from_sub_file(sub_file: &SubtitleFile) -> Result<Self, SyncError>

Create TimeSpans instance from subtitle file

Source

pub fn to_alass_timespans(&self, interval: i64) -> Vec<TimeSpan>

Convert TimeSpans from subparse to alass_core representation

Trait Implementations§

Source§

impl From<&VoiceActivity> for TimeSpans

Analyze vector of voice-activity data and produce TimeSpans

Source§

fn from(activity: &VoiceActivity) -> TimeSpans

Converts to this type from the input type.
Source§

impl IntoIterator for TimeSpans

Allow for iteration over internal subparse::TimeSpan elements

Source§

type Item = TimeSpan

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<<TimeSpans as IntoIterator>::Item>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl TryFrom<&[u8]> for TimeSpans

Deserializes TimeSpans instance from raw bytes

Source§

type Error = Error

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

fn try_from(bytes: &[u8]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryInto<Vec<u8>> for &'a TimeSpans

Serializes TimeSpans instance to raw bytes

Source§

type Error = Error

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

fn try_into(self: &'a TimeSpans) -> Result<Vec<u8>, Self::Error>

Performs the conversion.

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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.