pub fn check_decode_error_envelope<D>(dec: D, malformed: &[u8]) -> Conformancewhere
D: DecoderConfig + 'static,Expand description
A codec’s ErrorCategory and originating codec
name survive dyn-dispatch type erasure — the runtime half of the Pattern-B
contract.
Drives the decoder through the dyn boundary (&dyn DynDecoderConfig →
dyn_job → probe) on input
the codec rejects, so the typed At<CodecError> is erased to the BoxedError
a generic pipeline actually holds. It then recovers the envelope from that
Box<dyn Error> and asserts both
error_category and the
codec name come back.
A Pattern-A codec (native-enum type Error) fails here: its category may
exist on the typed value, but it is unrecoverable once erased — which is the
whole point of the envelope, and what this check exists to catch.
assert_uses_codec_error_envelope is the compile-time companion; this proves
the category genuinely propagates. Not part of check_all (see that note).
malformed must be bytes this codec rejects — any non-decodable input, a short
garbage buffer is usually enough. If the codec accepts them, the check says so
rather than passing silently.