Imported from mythrnr/wmf-rs (
AGENTS.md). Install upstream withnpx skills add mythrnr/wmf-rs. Copyright stays with the author.
AGENTS.md
A Rust library for parsing WMF (Windows Metafile) binaries and converting them to SVG. Conforms to the MS-WMF specification.
Project Structure
Cargo workspace with 3 crates:
core/- wmf-core: parsing (parsermodule) and conversion (convertermodule). Output formats are pluggable via thePlayertrait;SVGPlayeris the built-in implementation.cli/- wmf-cli: CLI tool (cli/src/main.rsonly)wasm/- wmf-wasm: WASM bindings (wasm/src/lib.rsonly)
See README.md for feature flags, CLI usage, and the WASM API. See the
Makefile for all build targets, including the WASM builds and the optional
Docker dev shell (make docker-dev).
Constraints
wmf-coreandwmf-wasmare#![no_std]. Use thealloccrate (Vec, String, BTreeMap); never introducestddependencies. I/O is abstracted viaembedded_io::Read, re-exported at the crate root.- All WMF data is read in little-endian byte order.
- Rust 1.88.0 is pinned via
rust-toolchain.toml; nightly is required for rustfmt and cargo-udeps.
Conventions
- All in-code text (comments, log messages, error messages) must be English.
- Errors are defined with
snafu. Logging usestracingand can be disabled via thetracingfeature flag. - WMF record type names follow the specification in
UPPER_SNAKE_CASE(non_camel_case_typesandnon_snake_caseare allowed for this reason). - clippy runs
all+pedanticatwarnlevel. Format withcargo +nightly fmt(make fmt); line width is 80 including comments. - When adding new WMF terms, add them to the
wordslist in.vscode/cspell.jsonso cSpell accepts them.
Build & Test
- Day-to-day checks:
make test,make lint,make fmt - Full suite before a PR:
make ci-suite - CI on PRs and pushes to master runs
make fmt,make lint,make doc-check,make spell-check, andmake test make doc-checkbuilds the docs withRUSTDOCFLAGS="-D warnings", so a broken intra-doc link or invalid HTML in a doc comment fails the buildmake install-toolsbulk-installs the host tooling
Testing
- Inline tests (
#[cfg(test)]) live alongside the implementation undercore/src/; shared helpers are in thetest_helpersmodule incore/src/parser/records/mod.rs. - Integration tests live in
core/tests/withcore/tests/mod.rsas the entry point.
Releases
- Main branch:
master(direct pushes are forbidden; changes land via PR) make release version=<x.y.z>creates arelease/<x.y.z>branch frommaster, bumps[workspace.package].versionand dependent version requirements viacargo release version, then refreshesCargo.lock. Commit the result through a normal PR.- When the bump lands on
master,.github/workflows/tag-release.yamlcreates the matching bare<version>tag and invokes.github/workflows/release.yamlin the same run (a tag pushed withGITHUB_TOKENcannot trigger workflows). The release workflow fails if the version does not equal the workspace version, then publishes the WASM bundles as GitHub Releases assets. - All crates share the single version in
[workspace.package]and are released in lockstep: the release tag must equal that version, andwmf-coreis published to crates.io with the same version.wmf-cliandwmf-wasmkeeppublish = falseuntil their first crates.io release is prepared.