Skip to main content

parse_frame

Function parse_frame 

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

Checks whether buf contains a complete RESP3 frame and parses it.

Bulk string data is copied out of the buffer. Prefer parse_frame_bytes on hot paths when a Bytes reference is available.

Returns Ok(Some(frame)) if a complete frame was parsed, Ok(None) if the buffer doesn’t contain enough data yet, or Err(...) if the data is malformed.