Expand description
§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
.
Modules§
- error
- Error types for the crate.
Structs§
- DbdFile
- Parsed and validated file.
- Definition
- Parsed and validated definition.
- Entry
- Specific entry or column in a DBC.
- Foreign
Key - Foreign key.
- Layout
- Representation of the layout.
- RawColumn
- Column definition found under
COLUMNS
. - RawDbd
File - An entire
.dbd
file with all subtypes. - RawDefinition
- Definition for specific set of versions.
- RawEntry
- Entry for specific column in a
RawDefinition
. - Version
WoW
client version representation.- Version
Range - Representation of version range.
Enums§
Constants§
- PLACEHOLDER_
NAME - Placeholder name used in
load_file
in case the filename is invalid.
Functions§
- load_
file - Wrapper over
load_file_from_string
. - load_
file_ from_ string - Load DBD file from string.
- write_
to_ file - Write the
RawDbdFile
to a string in the.dbd
format.