Struct hltas::types::HLTAS

source ·
pub struct HLTAS {
    pub properties: Properties,
    pub lines: Vec<Line>,
}
Expand description

A HLTAS script.

Fields§

§properties: Properties

Properties before the frames section.

§lines: Vec<Line>

Contents of the frames section.

Implementations§

source§

impl HLTAS

source

pub fn from_str(input: &str) -> Result<Self, Error<'_>>

Parses a .hltas script.

Examples
use std::fs::read_to_string;
use hltas::HLTAS;

let contents = read_to_string("script.hltas")?;
match HLTAS::from_str(&contents) {
    Ok(hltas) => { /* ... */ }

    // The errors are pretty-printed with context.
    Err(error) => println!("{}", error),
}
source

pub fn to_writer<W: Write>(&self, writer: W) -> Result<(), GenError>

Outputs the script in the .hltas format.

Examples
use std::fs::File;
use hltas::HLTAS;

fn save_script(hltas: &HLTAS) -> Result<(), Box<dyn std::error::Error>> {
    let file = File::create("script.hltas")?;
    hltas.to_writer(file)?;
    Ok(())
}
source

pub fn frame_bulks( &self ) -> FilterMap<Iter<'_, Line>, fn(_: &Line) -> Option<&FrameBulk>>

Returns an iterator over frame bulks of the script.

Examples
use hltas::HLTAS;

fn check_frame_bulks(hltas: &HLTAS) {
    for frame_bulk in hltas.frame_bulks() {
        // ...
    }
}
source

pub fn frame_bulks_mut( &mut self ) -> FilterMap<IterMut<'_, Line>, fn(_: &mut Line) -> Option<&mut FrameBulk>>

Returns an iterator over mutable frame bulks of the script.

Examples
use hltas::HLTAS;

fn modify_frame_bulks(hltas: &mut HLTAS) {
    for frame_bulk in hltas.frame_bulks_mut() {
        // ...
    }
}

Trait Implementations§

source§

impl Clone for HLTAS

source§

fn clone(&self) -> HLTAS

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 HLTAS

source§

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

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

impl Default for HLTAS

source§

fn default() -> HLTAS

Returns the “default value” for a type. Read more
source§

impl PartialEq<HLTAS> for HLTAS

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for HLTAS

Auto Trait Implementations§

§

impl RefUnwindSafe for HLTAS

§

impl Send for HLTAS

§

impl Sync for HLTAS

§

impl Unpin for HLTAS

§

impl UnwindSafe for HLTAS

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.