Srt

Struct Srt 

Source
pub struct Srt { /* private fields */ }

Implementations§

Source§

impl Srt

Source

pub fn iter(&self) -> Iter<'_, SrtData>

Examples found in repository?
examples/random_colors_from_subrip.rs (line 12)
6fn main() {
7    let hexcolor = AssFileOptions::get_ass_color(HexColor::YELLOW);
8    let srt_file = AssFile::from_srt("RapGod.srt");
9    let mut ass_file = AssFile::new();
10    let mut event = Events::default();
11
12    for srt_seg in srt_file.iter() {
13        let start = &srt_seg.start;
14        let end = &srt_seg.end;
15        let text = &srt_seg.text;
16
17        let random_color:HexColor = rand::random();
18
19        let dialogue = Dialogue::default()
20            .set_start(&start)
21            .set_end(&end)
22            .set_text(&text)
23            .set_colour(random_color);
24
25        event.add_dialogue(dialogue);
26    }
27    
28
29    ass_file.components.script
30        .set_script(ScriptInfo::default());
31
32
33
34    ass_file.components.v4
35        .set_v4(V4Format::default())
36        .set_primarycolour(&hexcolor);
37    ass_file.components.events
38        .set_events(event);
39
40    AssFile::save_file(&ass_file, "new_subtitle.ass");
41}

Auto Trait Implementations§

§

impl Freeze for Srt

§

impl RefUnwindSafe for Srt

§

impl Send for Srt

§

impl Sync for Srt

§

impl Unpin for Srt

§

impl UnwindSafe for Srt

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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V