1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! Rust types for the [40kdc-data](https://github.com/Tabletop-Developer-Consortium/40kdc-data)
//! Warhammer 40K schema layer.
//!
//! Every type in this crate is generated from the canonical JSON Schemas by
//! `cargo run -p xtask -- codegen`. The schema content these types describe is
//! published under CC0 — see the crate README.
//!
//! ```
//! use wh40kdc::Unit;
//!
//! let data = std::fs::read_to_string("path/to/units.json").unwrap_or("[]".to_string());
//! let units: Vec<Unit> = serde_json::from_str(&data).unwrap();
//! ```
//!
//! With the default `bundled-data` feature the whole dataset ships embedded
//! behind a linked, typed API ([`Dataset`]) — find an entity and follow it to
//! its weapons, abilities, phases, and faction:
//!
//! ```
//! # #[cfg(feature = "bundled-data")] {
//! use wh40kdc::{Dataset, Phase};
//!
//! let ds = Dataset::embedded();
//! let kharn = ds.find_unit("Kharn").unwrap(); // resolves "Khârn the Betrayer"
//! let shooting: Vec<&str> = ds
//! .abilities_of(kharn)
//! .into_iter()
//! .filter(|a| ds.phases_of(a).contains(&Phase::Shooting))
//! .map(|a| a.ability_id.as_str())
//! .collect();
//! assert_eq!(shooting, ["berzerker-frenzy"]);
//! # }
//! ```
// generated.rs is prettyplease-formatted by the codegen (see xtask); skip rustfmt
// so `cargo fmt` doesn't fight the committed output / CI drift check.
pub use *;
/// Linked, typed access over the embedded dataset (default `bundled-data`).
pub use ;
/// Army-list importer: ListForge share payload + NewRecruit (JSON / wtc /
/// simple) → resolved 40kdc roster (default `import`). The same module
/// hosts the [`Roster`](import::Roster) domain types, which are also reused
/// by the exporter — so it stays available whenever either `import` or
/// `export` is enabled.
/// Roster exporter: resolved [`Roster`](import::Roster) → NewRecruit JSON /
/// wtc-compact / wtc-full / simple / canonical Roster JSON (default
/// `export`). Dataset-free — outputs depend only on the Roster shape, which
/// keeps Rust and TS byte-identical for export goldens.
/// Expected-value damage-projection engine: pure-function math over schema
/// profiles and a flat [`Buff`](cruncher::Buff) stack (default `cruncher`).
/// Mirrors `tools/src/cruncher/` in the TS package; the
/// `conformance/cruncher/` corpus pins both implementations to within
/// `5e-4` per pipeline stage.
/// The bundled, self-contained JSON Schema (draft 2020-12) these types were
/// generated from. Consumers can feed this to a JSON Schema validator to check
/// data before deserializing; the canonical validation CLI lives in the
/// `@alpaca-software/40kdc-data` npm package.
pub const BUNDLED_SCHEMA: &str = include_str!;