use redify::{Push, __private::Pipeline}; use redis::{Client, ConnectionLike, RedisError}; #[derive(Push)] struct Bar { b: String, c: Vec, } impl ::redify::Pull for Bar { fn pull(key: K, field: Option, pipe: &mut ::redify::__private::Pipeline) where K: ::redis::ToRedisArgs + ::std::fmt::Display, F: ::redis::ToRedisArgs + ::std::fmt::Display, { let mut key = key.to_string(); if let Some(ref field) = field { key = { let res = format!("{0}::{1}", key, field); res }; } ::pull(&key, Some("b"), pipe); as ::redify::Pull>::pull(&key, Some("c"), pipe); } fn from_result(res: redis::Value) -> Self { todo!() } } #[derive(Push)] struct Foo { a: String, sub: Bar, } #[allow(clippy::disallowed_names)] fn main() -> Result<(), RedisError> { let client = Client::open("redis://localhost:6379")?; let mut con = client.get_connection()?; let foo = Foo { a: "abc".to_owned(), sub: Bar { b: "def".to_owned(), c: vec![ "Hello world".to_owned(), "Hello world".to_owned(), "Hello world".to_owned(), "Hello world".to_owned(), "Hello world".to_owned(), ], }, }; let mut pipe = Pipeline::new(); foo.push::<_, String>("key2", None, &mut pipe); let packed_pipe = pipe.get_packed_pipeline(); con.req_packed_commands(&packed_pipe, 0, 3)?; Ok(()) }