Skip to main content

Module parse

Module parse 

Source
Expand description

Zero-copy RESP3 parser.

Operates on buffered byte slices. The caller is responsible for reading data from the network into a buffer — this parser is purely synchronous.

The parser uses a Cursor<&[u8]> to track its position through the input buffer without consuming it, allowing the caller to retry once more data arrives.

§Single-pass design

Earlier versions used a two-pass approach: check() to validate a complete frame exists, then parse() to build Frame values. This scanned every byte twice. The current implementation does a single pass that builds Frame values directly, returning Incomplete if the buffer doesn’t contain enough data yet.

Functions§

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