Trait subparse::SubtitleFileInterface[][src]

pub trait SubtitleFileInterface {
    fn get_subtitle_entries(&self) -> Result<Vec<SubtitleEntry>>;
fn update_subtitle_entries(&mut self, i: &[SubtitleEntry]) -> Result<()>;
fn to_data(&self) -> Result<Vec<u8>>; }

This trait represents the generic interface for reading and writing subtitle information across all subtitle formats.

This trait allows you to read, change and rewrite the subtitle file.

Required methods

fn get_subtitle_entries(&self) -> Result<Vec<SubtitleEntry>>[src]

The subtitle entries can be changed by calling update_subtitle_entries().

fn update_subtitle_entries(&mut self, i: &[SubtitleEntry]) -> Result<()>[src]

Set the entries from the subtitle entries from the get_subtitle_entries().

The length of the given input slice should always match the length of the vector length from get_subtitle_entries(). This function can not delete/create new entries, but preserves everything else in the file (formatting, authors, …).

If the input entry has entry.line == None, the line will not be overwritten.

Be aware that .idx files cannot save time_spans_ (a subtitle will be shown between two consecutive timepoints/there are no separate starts and ends) - so the timepoint will be set to the start of the corresponding input-timespan.

fn to_data(&self) -> Result<Vec<u8>>[src]

Returns a byte-stream in the respective format (.ssa, .srt, etc.) with the (probably) altered information.

Loading content...

Implementors

Loading content...