pub fn decode(buf: &[u8]) -> Result<Envelope<'_>, Error>Expand description
Parses and validates the envelope at the start of buf.
Trailing bytes after the CRC are accepted; use Envelope::len to step to the next
envelope. Checks run in this order: header length, magic, version, flags/reserved,
payload length, CRC. Error::Incomplete means “more bytes needed” (e.g. a file cut
by a crash); Error::ChecksumMismatch means a complete envelope whose CRC is wrong,
i.e. real corruption. Never panics.