Skip to main content

decode_header

Function decode_header 

Source
pub fn decode_header(bytes: &[u8]) -> Result<EnvelopeHeader, DecodeError>
Expand description

Decode an envelope header from the front of bytes, following the frozen-prefix discipline:

  1. need at least the 5-byte prefix to read len + ver;
  2. dispatch the full header length on ver;
  3. need the full header present; then parse the rest.

Never panics on malformed input — returns a typed DecodeError.