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");Connections 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
Commandtrait + impelementations.- model
- Redis models.
- pool
- Manage Redis connections with deadpool.
- script
- Script utilities to handle SHA1 hash-based invocation.
Structs§
- Codec
- Tokio codec with
EncoderandDecoderfor RESP. - Connection
- A TCP connection to a Redis server.
Type Aliases§
- Error
- Static
resp::Errorreturned fromConnectionandCodec. - Result
- Result with an error type defaulting to
Error. - Shared
Connection - A
Connectionthat can be shared across threads.