Expand description
Prevent resolved versions in Cargo.lock from regressing below a
committed baseline that only ratchets up.
The binary (cargo ratchet) is a thin wrapper over this library. Embed
the library when you want the same check inside another tool:
compute_violationsis the pure comparison: two parsed lockfiles in, violations out.check_and_advanceadds the file orchestration: compare, and copy the lockfile over the baseline on a passing check.check_fail_on_changeis the read-only CI variant: pass only when the baseline is byte-identical to the lockfile.
Structs§
- Ratchet
Paths - Locations of the lockfile and its ratchet baseline.
Enums§
- Violation
- A place where resolved
Cargo.lockstate regressed below the baseline.
Functions§
- check_
and_ advance - Check the lockfile against the ratchet baseline and, when the check passes (an empty return), copy the lockfile over the baseline so the floor ratchets up. A missing baseline is not a violation: the first run bootstraps it.
- check_
fail_ on_ change - Read-only check for CI: returns whether the baseline is byte-identical to
the lockfile (a missing baseline is a mismatch). Byte-identical files
trivially contain no regressions, so nothing is parsed; on a throwaway
checkout an advance would be discarded, so any mismatch means someone
needs to run
cargo ratchetlocally and commit the result. - compute_
violations - Compare
currentagainstbaselineand report every regression of resolved versions.