1 unstable release

0.1.0 Nov 30, 2022

#2133 in Parser implementations

MIT/Apache

49KB
1K SLoC

wowdbdefs-rs

Rust library for parsing WoWDBDefs/.dbd files.

Usage

Add the following to your Cargo.toml:

[description]
wowdbdefs-rs = "0.1"

and then read the docs.

MSRV

wowdbdefs-rs has a Minimum Supported Rust Version (MSRV) of 1.58.1. The MSRV may be increased in PATCH versions before wowdbdefs-rs reaches 1.0.0 (MAJOR.MINOR.PATCH).

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

WoWDBDefs-rs

Crate for reading the .dbd format from the WoWDBDefs repository.

Example

// From &str
// Ensure that the .dbd name is correct
let file = load_file_from_string(contents, "Map.dbd")?.into_proper()?;

// Or from a path
// `load_file` has two levels of error, one is io::Error the other is ParseError
let file = load_file(path)??.into_proper()?;

// Then either use the parsed types with into_proper which is a more ergonomic API
for definition in &file.definitions {
    for entry in &definition.entries {
        println!("{}", entry.name);
        println!("{:#?}", entry.ty);
    }
}

// Or the raw types which are a direct representation of the format
let file = load_file(path)??;

for definition in &file.definitions {
    for entry in &definition.entries {
        println!("{}", entry.name);
        let column = file.columns.get(&entry.name).ok_or("unable to find column")?;
        println!("{:#?}", column.ty);
    }
}

Usage

Add the following to your Cargo.toml:

[dependencies]
wowdbdefs-rs = "0.1.0"

MSRV

The MSRV for this crate is 1.58.1.

No runtime deps