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
impl HLTAS
sourcepub fn from_str(input: &str) -> Result<Self, Error<'_>>
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),
}
sourcepub fn to_writer<W: Write>(&self, writer: W) -> Result<(), GenError>
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(())
}
sourcepub fn frame_bulks(
&self
) -> FilterMap<Iter<'_, Line>, fn(_: &Line) -> Option<&FrameBulk>>
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() {
// ...
}
}
sourcepub fn frame_bulks_mut(
&mut self
) -> FilterMap<IterMut<'_, Line>, fn(_: &mut Line) -> Option<&mut FrameBulk>>
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 PartialEq<HLTAS> for HLTAS
impl PartialEq<HLTAS> for HLTAS
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more