Crates.io | tinyresp |
lib.rs | tinyresp |
version | 0.2.1 |
source | src |
created_at | 2024-01-29 20:26:06.948126 |
updated_at | 2024-02-29 22:13:31.721471 |
description | A tiny Rust library implementing the Redis Serialization Protocol (RESP) |
homepage | |
repository | https://github.com/lmammino/tinyresp |
max_upload_size | |
id | 1119322 |
size | 40,720 |
A tiny Rust library implementing the Redis Serialization Protocol (RESP)
A simple parser for the RESP protocol (REdis Serialization Protocol).
For an overview of the procol check out the official Redis SErialization Protocol (RESP) documentation
This library is written using nom
and therefore uses an incremental parsing approach.
This means that using the [parse
] method will return a Result
containing a tuple with 2 elements:
use tinyresp::{parse_value, Value};
let message = "*2\r\n$5\r\nhello\r\n$5\r\nworld\r\n";
let (remaining_input, value) = parse_value(message).unwrap();
assert_eq!(remaining_input, "");
assert_eq!(value, Value::Array(vec![
Value::BulkString("hello"),
Value::BulkString("world")
]));
Everyone is very welcome to contribute to this project. You can contribute just by submitting bugs or suggesting improvements by opening an issue on GitHub.
Licensed under MIT License. © Luciano Mammino, Roberto Gambuzzi.