Expand description
Determinism primitives for repeatable output validation.
This crate isolates one responsibility: compare two output byte streams, hash them, and report bounded byte-level differences.
Use compare_outputs to check whether two codec runs produced identical bytes,
and blake3_hex for stable content hashing.
§Typical Workflow
ⓘ
use copybook_determinism::{compare_outputs, DeterminismMode};
let result = compare_outputs(DeterminismMode::DecodeOnly, &output_a, &output_b);
assert!(result.is_deterministic);Structs§
- Byte
Diff - Details about a byte difference found during determinism checking.
- Determinism
Result - Result of a determinism check operation.
Enums§
- Determinism
Mode - Mode of determinism checking (decode-only, encode-only, or full round-trip).
Constants§
- BLAK
E3_ HEX_ LEN - Hex-encoded BLAKE3 digest length in characters.
- DEFAULT_
MAX_ DIFFS - Default cap used when collecting byte-level differences.
Functions§
- blake3_
hex - Compute a lowercase hex BLAKE3 hash for a byte slice.
- compare_
outputs - Compare two byte slices and build a determinism result with default diff limit.
- compare_
outputs_ with_ limit - Compare two byte slices and build a determinism result with an explicit diff limit.
- find_
byte_ differences - Find byte-level differences between two slices using
DEFAULT_MAX_DIFFSentries at most. - find_
byte_ differences_ with_ limit - Find byte-level differences between two slices with an explicit limit.