1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! A crate for reading and writing Half-Life TAS scripts (`.hltas`).
//!
//! # Examples
//!
//! ```
//! # extern crate hltas;
//! # fn foo() -> Result<(), Box<dyn std::error::Error>> {
//! use hltas::{HLTAS, types::{JumpBug, Line, Times}};
//!
//! let contents = "\
//! version 1
//! demo test
//! frames
//! ------b---|------|------|0.001|-|-|5";
//!
//! match HLTAS::from_str(&contents) {
//!     Ok(hltas) => {
//!         assert_eq!(hltas.properties.demo, Some("test"));
//!
//!         if let Line::FrameBulk(frame_bulk) = hltas.lines[0] {
//!             assert_eq!(
//!                 frame_bulk.auto_actions.jump_bug,
//!                 Some(JumpBug { times: Times::UnlimitedWithinFrameBulk })
//!             );
//!             assert_eq!(frame_bulk.frame_time, "0.001");
//!             assert_eq!(frame_bulk.frame_count.get(), 5);
//!         } else {
//!             unreachable!()
//!         }
//!     }
//!
//!     // The errors are pretty-printed with context.
//!     Err(error) => println!("{}", error),
//! }
//! # Ok(())
//! # }
//! ```

#![doc(html_root_url = "https://docs.rs/hltas/0.3.0")]
#![deny(unsafe_code)]

pub mod types;
pub use types::HLTAS;

pub mod read;
mod write;