Expand description
Build-script helper for maat plugin crates.
A plugin’s build.rs is a one-liner:
ⓘ
fn main() { maat_plugin_build::emit_content_hash(); }The function walks the plugin’s src/ tree (sorted), hashes the file
contents along with Cargo.toml, optionally folds in the workspace
Cargo.lock entries for the crate’s deps, and emits
cargo:rustc-env=METAGAMER_PLUGIN_CONTENT_HASH=<hex>.
Lockfile-folding is best-effort: standalone-crate builds with no reachable workspace lockfile fall back to (src + Cargo.toml) and print a warning.
Functions§
- decode_
blake3_ hex - Decode a 64-hex-char string (such as the value baked into
METAGAMER_PLUGIN_CONTENT_HASH) into a 32-byte blake3 digest at runtime. ReturnsNoneif the input isn’t well-formed hex of length 64. - emit_
content_ hash - Walk the calling crate’s
src/, hash everything that affects build output, and emit theMETAGAMER_PLUGIN_CONTENT_HASHrustc-env variable plus rerun-if-changed directives.