#redis #serialization #serde #serde-json

redispatch

serialization and deserialization for redis

2 releases

0.0.2 May 9, 2023
0.0.1 May 9, 2023

#1440 in Encoding

MIT license

4KB

redispatch

best serialization patch for redis

usage

add dependencies

# Cargo.toml
redis = { version = "0.23.0", features = ["aio", "tokio-comp"] }
redispatch = "0.0.1"

import redispatch::JsonSerdeCommands to use

use futures::prelude::*;
use redispatch::JsonSerdeCommands;
use serde::{Serialize, de::DeserializeOwned};

#[derive(Debug, DeserializeOwned)]
struct MyData {
    username: String
}

let client = redis::Client::open("redis://127.0.0.1/").unwrap();
let mut con = client.get_async_connection().await?;

let serde_ret = con.get::<MyData>("mydata").await?;

Dependencies

~8–17MB
~212K SLoC