Skip to main content

decode

Function decode 

Source
pub fn decode(buf: &[u8]) -> Result<(Packet<'_>, usize), DecodeError>
Expand description

Decode a packet from the start of buf.

On success, returns the parsed packet and the number of bytes consumed (i.e. the wire length of the decoded packet). If the buffer is too short to contain a full packet but is otherwise consistent so far, returns DecodeError::Incomplete — callers can read more bytes and retry.