Skip to main content

decode

Function decode 

Source
pub fn decode(buf: &[u8]) -> Result<Frame, ProtocolError>
Expand description

Decode a wire buffer into a Frame.

Returns ProtocolError::BadMagic if the first four bytes are not MAGIC, ProtocolError::BadVersion if the version byte does not equal VERSION, and ProtocolError::Codec for any underlying postcard failure (including a buffer shorter than the prefix, which postcard surfaces as DeserializeUnexpectedEnd).