Skip to main content

Crate copybook_determinism

Crate copybook_determinism 

Source
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§

ByteDiff
Details about a byte difference found during determinism checking.
DeterminismResult
Result of a determinism check operation.

Enums§

DeterminismMode
Mode of determinism checking (decode-only, encode-only, or full round-trip).

Constants§

BLAKE3_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_DIFFS entries at most.
find_byte_differences_with_limit
Find byte-level differences between two slices with an explicit limit.