Skip to main content

Module validation

Module validation 

Source
Expand description

Fail-fast validation for public Config types.

Existing encode paths keep clamping out-of-range values (the historical behaviour callers may rely on). Batch-job callers who would rather see an error than have their input silently massaged can call crate::api::LossyConfig::validate / crate::api::LosslessConfig::validate (and, with the __expert cargo feature, [crate::effort::LossyInternalParams::validate] / [crate::effort::LosslessInternalParams::validate]) before invoking the encoder.

Validation is conservative: ranges either come from libjxl reference caps (verified against the consuming code path under src/vardct/, src/modular/, src/effort.rs) or are wide enough to accept anything the encoder will actually accept without panicking. Nonsensical-but-safe values (e.g. tree_max_buckets = u16::MAX) are left to the encoder to clamp.

Enumsยง

ValidationError
Errors produced by validate() on the public config types.