pub fn decode<T: DeserializeOwned>(
expected_version: u8,
bytes: &[u8],
) -> Result<T, CodecError>Expand description
Decode a payload produced by encode, rejecting a version mismatch.
Returns CodecError::Version when the leading byte differs from
expected_version — a stale reader fails loudly instead of parsing old
bytes against a new struct layout.