hltas_framebulk_analyzer/
lib.rs

1//! # Tool that analysis a hltas file or framebulks
2//!
3//! # How to use the app
4//! - Enter a full hltas file by pasting in the console, or framebulks without the full file
5//! - Enter EOF which can be done with `ctrl+D` on linux / macOS, or `ctrl+Z` on windows
6//! - Exit by force quitting with `ctrl+c`
7//!
8//! # Library usage example
9//! ```
10//! # use hltas::types::*;
11//! # use std::num::NonZeroU32;
12//! # use hltas_framebulk_analyzer::analyze_hltas;
13//! # use num_bigint::BigUint;
14//! # use rust_decimal_macros::dec;
15//! # use rust_decimal::prelude::FromPrimitive;
16//! # use hltas_framebulk_analyzer::analyzer::*;
17//! #
18//! let hltas = HLTAS {
19//!     properties: Properties::default(),
20//!     lines: vec![
21//!         Line::FrameBulk(FrameBulk {
22//!             frame_time: "0.001".to_string(),
23//!             frame_count: NonZeroU32::new(150).unwrap(),
24//!             auto_actions: Default::default(),
25//!             movement_keys: Default::default(),
26//!             action_keys: Default::default(),
27//!             pitch: Default::default(),
28//!             console_command: Default::default(),
29//!        }),
30//!        Line::FrameBulk(FrameBulk {
31//!            frame_time: "0.004".to_string(),
32//!            frame_count: NonZeroU32::new(150).unwrap(),
33//!            auto_actions: Default::default(),
34//!            movement_keys: Default::default(),
35//!            action_keys: Default::default(),
36//!            pitch: Default::default(),
37//!            console_command: Default::default(),
38//!        }),
39//!     ],
40//! };
41//!
42//! let analysis = analyze_hltas(&hltas).unwrap();
43//!
44//! // prints in a nice format
45//! println!("{}", analysis);
46//!
47//! assert_eq!(analysis.estimated_time, dec!(0.75));
48//! assert_eq!(analysis.frametime_stats, vec![
49//!     FrametimeStats {
50//!        frametime: dec!(0.001),
51//!        frame_count: BigUint::from_u32(150).unwrap(),
52//!     },
53//!     FrametimeStats {
54//!        frametime: dec!(0.004),
55//!        frame_count: BigUint::from_u32(150).unwrap(),
56//!     },
57//! ]);
58//! ```
59//!
60//! # Q & A
61//! - Q: Why is this colourful?
62//! - A: It looks cool thats why
63//!
64//! - Q: Why so many stats are printed on the console? It seems pointless
65//! - A: Idk more the better I guess
66//!
67//! - Q: Why not analyze the bxt logs directly instead if hltas only gives an estimated time?
68//! - A: That's why I'm making an analyzer that will take bxt logs, and maybe hltas together to made a better analysis of the TAS
69
70pub mod analyzer;
71
72pub use analyzer::analyze_hltas;
73
74#[cfg(test)]
75mod tests;