Skip to main content

Crate maat_plugin_build

Crate maat_plugin_build 

Source
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. Returns None if 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 the METAGAMER_PLUGIN_CONTENT_HASH rustc-env variable plus rerun-if-changed directives.