Skip to main content

decode

Function decode 

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

Decode one complete frame from a byte buffer.

Returns the decoded frame and the number of bytes consumed. Unknown frame types are length-delimited and returned as Frame::Unknown without producing an error.

ยงErrors

Returns ProtocolError::IncompleteHeader for buffers shorter than the fixed header, ProtocolError::TruncatedPayload when the declared payload is not fully present, and ProtocolError for malformed known-frame payloads or invalid stream placement.