Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Core Types

warcraft-rs does not have a shared core types library. Each crate defines its own types independently. This page documents common patterns across crates.

Math Types

The project uses glam for vector and matrix math. Individual crates define their own geometry structs for binary-compatible parsing (e.g., C3Vector, C4Quaternion in wow-m2).

Version Enums

Each crate that handles versioned formats defines its own version enum:

CrateVersion TypeVariants
wow-mpqFormatVersionV1, V2, V3, V4
wow-m2M2VersionVanilla, TBC, WotLK, Cataclysm, MoP, WoD, Legion, BfA, Shadowlands, Dragonflight, TheWarWithin
wow-wmoWmoVersionClassic, Tbc, Wotlk, Cataclysm, Mop, Wod, Legion, Bfa, Shadowlands, Dragonflight, WarWithin
wow-wdtWowVersionClassic, TBC, WotLK, Cataclysm, MoP, WoD, Legion, BfA, Shadowlands, Dragonflight
wow-adtAdtVersionVanillaEarly, VanillaLate, TBC, WotLK, Cataclysm, MoP
wow-wdlWdlVersionVanilla, Wotlk, Cataclysm, Mop, Wod, Legion, Bfa, Shadowlands, Dragonflight, Latest

Chunk-based Parsing

Several WoW file formats use a chunk-based structure with four-character codes (FourCC). The project handles this differently per crate:

  • wow-wdt: Defines a Chunk trait that chunk types implement
  • wow-adt, wow-wmo: Uses binrw 0.14 with declarative chunk parsing
  • wow-wdl: Custom parser that reads chunks sequentially
  • wow-m2: Custom ReadExt trait for reading binary data

Flag Types

The project uses the bitflags crate for type-safe flag handling in format-specific contexts.

Serialization

Crates that support serialization use serde behind feature flags:

  • wow-m2: serde-support feature
  • wow-wdt: serde feature
  • wow-cdbc: serde feature (also csv_export, yaml)

API Reference

For detailed type documentation, see the per-crate API docs on docs.rs:

See Also