Expand description
A simple Redis client & RESP parser for Rust.
use redust::{resp::{Data, from_data}, Connection};
let mut conn = Connection::new("localhost:6379").await?;
let res: Data = conn.cmd(["PING"]).await?;
let deserialized: &str = from_data(res)?;
assert_eq!(deserialized, "PONG");
Connection
s implement TryStream
and Sink
for ergonomic
and idiomatic use.
Data is returned to the client as static resp::Data
. The resp crate contains several
serde utilities for converting RESP into Rust structures. For reading data from a connection,
use resp::from_data
.
§Additional Features
Re-exports§
pub use redust_resp as resp;
Modules§
- command
Command
trait + impelementations.- model
- Redis models.
- pool
- Manage Redis connections with deadpool.
- script
- Script utilities to handle SHA1 hash-based invocation.
Structs§
- Codec
- Tokio codec with
Encoder
andDecoder
for RESP. - Connection
- A TCP connection to a Redis server.
Type Aliases§
- Error
- Static
resp::Error
returned fromConnection
andCodec
. - Result
- Result with an error type defaulting to
Error
. - Shared
Connection - A
Connection
that can be shared across threads.