Skip to main content

Crate ltk_ritobin

Crate ltk_ritobin 

Source
Expand description

Ritobin text format parser and writer for League Toolkit.

This crate provides functionality to parse and write the ritobin text format, which is a human-readable representation of League of Legends bin files.

§Example

use ltk_ritobin::{parse, write};

// Parse ritobin text
let text = r#"
#PROP_text
type: string = "PROP"
version: u32 = 3
"#;

let file = parse(text).unwrap();
let tree = file.to_bin_tree();

// Write back to text
let output = write(&tree).unwrap();

§Error Reporting

Parse errors include span information compatible with miette for rich error reporting with source highlighting:

use ltk_ritobin::parse;
use miette::Report;

let text = "test: badtype = 42";
match parse(text) {
    Ok(file) => { /* ... */ }
    Err(e) => {
        // Print with miette formatting
        eprintln!("{:?}", Report::new(e));
    }
}

Re-exports§

pub use parser::parse;
pub use parser::parse_to_bin_tree;
pub use parser::RitobinFile;
pub use error::*;
pub use hashes::*;
pub use types::*;
pub use writer::*;

Modules§

error
Error types for ritobin parsing and writing.
hashes
Hash provider traits and implementations for ritobin writing.
parser
Nom parser for ritobin text format with span tracking for error reporting.
types
Type name mappings for ritobin format.
writer
Text writer for ritobin format.