redis-parser

Crates.ioredis-parser
lib.rsredis-parser
version0.1.2
sourcesrc
created_at2020-11-15 22:31:40.366507
updated_at2020-11-15 23:46:21.404058
descriptionA zero-copy parser for the RESP2 and RESP3 protocols, used by Redis
homepage
repositoryhttps://github.com/orf/redis-protocol-parser
max_upload_size
id312698
size43,624
Tom Forbes (orf)

documentation

README

Redis Protocol Parser

Crates.io Docs Run Tests

This library provides a high-performance, zero-copy parser for the RESP2 and RESP3 protocols.

Usage

There are two simple parse functions depending on the protocol you want. This library uses the nom parsing library and is built around streaming data into the parser.

use redis_parser::resp2::{parse as parse2, Resp2Type};
use redis_parser::resp3::{parse as parse3, Resp3Type};

assert_eq!(parse2("+test\r\n".as_bytes()), Ok((&b""[..], Resp2Type::String("test"))));
assert_eq!(parse3("#f\r\n".as_bytes()), Ok((&b""[..], Resp3Type::Boolean(false))));
Commit count: 20

cargo fmt