Skip to main content

decode

Function decode 

Source
pub fn decode<T: for<'de> FromMessagePack<'de>>(
    magic: &[u8; 5],
    expected_version: u8,
    buf: &[u8],
) -> Result<T, CodecError>
Expand description

Validate the envelope header and deserialize the body into T.

expected_version is checked exactly — bumping a codec’s on-disk format is an explicit decision; silently accepting older bodies has bitten us before. Callers that need a window of compatible versions should call peek_version and dispatch.