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

#502 in Database interfaces

Download history 2/week @ 2024-01-08 17/week @ 2024-02-05 26/week @ 2024-02-26 178/week @ 2024-03-04 6/week @ 2024-03-11 137/week @ 2024-03-18 207/week @ 2024-03-25 52/week @ 2024-04-01 150/week @ 2024-04-08 18/week @ 2024-04-15

433 downloads per month

MIT license

75KB
2K SLoC

Respite

Some tools for reading and writing RESP streams.

Crates.io Docs Build Status

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.9–4.5MB
~80K SLoC