Skip to main content

frame_decode

Function frame_decode 

Source
pub fn frame_decode(buf: &[u8]) -> Result<Option<(&[u8], usize)>, DecodeError>
Expand description

Parse one frame from the front of buf. Ok(None) means the buffer does not yet hold a whole frame, so read more bytes. Ok(Some((payload, consumed))) is one payload and how many bytes of buf it spanned (4 + len). Errors when the length prefix exceeds MAX_FRAME_BYTES.