| Crates.io | grapple_redis_macros |
| lib.rs | grapple_redis_macros |
| version | 0.2.0 |
| created_at | 2025-06-08 14:59:53.305676+00 |
| updated_at | 2025-06-10 13:02:02.692644+00 |
| description | Helper macros for `grapple_db` Redis Client |
| homepage | |
| repository | https://github.com/grapple228/rust_redis_macros.git |
| max_upload_size | |
| id | 1704953 |
| size | 33,530 |
grapple_redis_macros is a procedural macro library designed to simplify the deserialization of Redis values into Rust structs for use with the grapple_db Redis Client. This library provides a convenient way to automatically implement the FromRedisValue trait for your structs, enabling seamless integration with Redis data stored in JSON format.
FromRedisValue trait for your structs, simplifying the process of deserializing Redis values.To use this library, your model must implement the serde::Serialize and serde::Deserialize traits.
Add the following to your Cargo.toml:
[dependencies]
grapple_redis_macros = "0.2"
serde_json = "1"
// Or any library that re-imports redis-rs
use redis::{self, FromRedisValue};
use grapple_redis_macros::FromRedisValue;
// Add `FromRedisValue` macros
#[derive(serde::Serialize, serde::Deserialize, FromRedisValue)]
struct MyStruct{
field1: String,
field2: i32,
}
fn example(redis_value: &redis::Value) -> Result<MyStruct, redis::RedisError> {
MyStruct::from_redis_value(redis_value)
}
This project is licensed under the MIT License. See the LICENSE file for details.