Crate redust

Source
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

  • command: type-safe Redis interactions
  • pool: connection pooling with [bb8]
  • model: complex Redis responses, based on serde
  • script: Redis scripting utilities

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 and Decoder for RESP.
Connection
A TCP connection to a Redis server.

Type Aliases§

Error
Static resp::Error returned from Connection and Codec.
Result
Result with an error type defaulting to Error.
SharedConnection
A Connection that can be shared across threads.