Skip to main content

parse_reply

Function parse_reply 

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

Parse one RESP reply from the front of buf. Speaks RESP2 + RESP3.

  • Ok(Some((reply, consumed))) — a complete reply.
  • Ok(None) — need more bytes.
  • Err(_) — malformed.

Attributes (|N\r\n…<reply>) are transparently consumed and discarded — they decorate the next reply but the parser surfaces only the underlying reply, matching what every RESP3 client library does today. Exposing them is a future addition once a real consumer (e.g. CLIENT TRACE) ships.