- Root
Cargo.tomldefines the workspace: core library incrates/toon/src/{decode,encode,ser}and CLI incrates/toon-cli. - Integration tests live in
crates/toon/testsandcrates/toon-cli/tests; add end-to-end cases next to files such asencode_basic.rs. spec/vendors the official TOON fixtures; sync them when conformance behavior changes and include updates in the PR.fuzz/holds the cargo-fuzz setup and helper scripts; stash new seeds infuzz/corpusand crashes infuzz/artifacts.
cargo fmt --allformats the workspace (CI runs--check).cargo clippy --workspace -- -D warningsmust be clean before pushing.cargo build --workspaceverifies both crates compile with default features.cargo test --workspaceruns library and CLI test suites.TOON_CONFORMANCE=1 cargo test -p toon --testsexercises the specification fixtures (requiresspec/tests/fixtures).cargo run -p toon-cli -- encode examples/request.jsonprovides a quick CLI smoke test../fuzz/fuzz.sh run decodekicks off the recommended fuzz target.
- Rust 2024 edition with the stable toolchain (
rust-toolchain.toml); stick to 4-space indentation and rustfmt defaults. - Follow standard casing:
snake_casefor functions,CamelCasefor types,SCREAMING_SNAKE_CASEfor constants. - Keep parsing helpers in
decode, encoding logic inencode, and shared structures invalue.rs; avoid cross-module glob imports. - Treat Clippy warnings as errors and add concise comments only when behavior is non-obvious.
- Place integration tests in
crates/toon/testsor CLI checks incrates/toon-cli/tests; reuse naming patterns such asstrict_tabular.rs. - Update spec fixtures when parser or encoder behavior shifts and rerun the
TOON_CONFORMANCEsuite before committing. - Extend benches in
crates/toon/benchesfor performance-sensitive changes and capture representative inputs. - Use the fuzz harness for parser regressions, keeping minimized cases under
fuzz/corpusso they run in CI smoke tests. Run fromfuzz/via./fuzz.sh run fuzz_structured -- -max_total_time=600(script selects the nightly toolchain).
- Use conventional-style commits (
feat(encode): add strict table validation) or match the focused subject lines already in history. - Squash exploratory commits before opening a PR and push well-scoped branches (e.g.,
feature/strict-mode-fixes). - PRs should describe motivation, list tests run, and link related issues; include CLI output or TOON samples when behavior changes.
- Confirm
fmt,clippy, default tests, and conformance tests (when relevant) before requesting review.