14 releases
new 0.3.7 | Jan 15, 2025 |
---|---|
0.3.6 | Jan 6, 2025 |
0.3.4 | Dec 31, 2024 |
0.3.3 | Apr 13, 2024 |
0.1.3 | Jan 13, 2024 |
#990 in Database interfaces
390 downloads per month
78KB
2K
SLoC
Respite
Some tools for reading and writing RESP streams.
Usage
To use respite
, add this to your Cargo.toml
:
[dependencies]
respite = "*"
Next, add this to your crate:
use respite::{RespReader, RespWriter, RespVersion};
lib.rs
:
Abstractions for reading the RESP protocol.
You can read a RESP stream in several ways. Which one is appropriate depends on your goals.
Frames
With RespReader::frame
, you can read each individual frame from a RESP stream and decide
what to do with it. This allows you to process streams without buffering.
Requests
RespReader::requests
will pass each component of a Redis-style request to a closure you
provide. This allows for easily sending each argument over a channel to another task.
Values
You can also use RespReader::value
, which will buffer values and return a whole tree of
frames for arrays, maps, sets, etc. This is primarily meant for testing purposes, but could
also be useful in cases where performance isn't super important.
Dependencies
~2.8–9MB
~77K SLoC