Crate undis

Source
Expand description

§undis

undis is a serde-compatible Redis library for Rust.

§Sending a request

For most use cases the Client is the only thing you need to know.

use undis::Client;
use serde::{Serialize, Deserialize};

#[derive(Debug, PartialEq, Serialize, Deserialize)]
struct Table {
    foo: String,
    bar: i32,
    baz: bool,
}

let client = Client::new(20, addr).await?;

let value = Table { foo: "foo".into(), bar: 42, baz: true };
client.hset("my-key", &value).await?;
let fetched: Table = client.hmget("my-key").await?;

assert_eq!(value, fetched);

§Sending a custom request

You may want to send some requests which are not supported as a method. This is possible using raw_command.

let res: MyStruct = client.raw_command(("CUSTOMCOMMAND", "ARG1", 42, "ARG2", "FOO")).await?;

Re-exports§

Modules§