Zero-copy RESP2 and RESP3 protocol parser and serializer.
resp-rs provides high-performance parsing and serialization for the
Redis Serialization Protocol (RESP), supporting both RESP2 and RESP3.
Features
- Zero-copy parsing using
bytes::Bytesfor efficient memory management - RESP2 and RESP3 support with separate frame types
- Streaming parser for incremental data (handles partial reads and pipelining)
- High performance: 4.8-8.0 GB/s throughput in benchmarks
Quick Start
RESP3 (recommended for new projects)
use Bytes;
use resp3;
let data = from;
let = parse_frame.unwrap;
assert_eq!;
RESP2
use Bytes;
use resp2;
let data = from;
let = parse_frame.unwrap;
assert_eq!;
Streaming parser (handles partial reads)
use Bytes;
use Parser;
let mut parser = new;
// Feed partial data
parser.feed;
assert!; // Incomplete
// Feed the rest
parser.feed;
let frame = parser.next_frame.unwrap.unwrap; // Complete!