10 releases
0.3.3 | Apr 13, 2024 |
---|---|
0.3.2 | Mar 30, 2024 |
0.2.1 | Mar 4, 2024 |
0.2.0 | Feb 5, 2024 |
0.1.3 | Jan 13, 2024 |
#926 in Database interfaces
646 downloads per month
75KB
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