Question: How to wrap pipeline in function
immerhart opened this issue · comments
immerhart commented
Trying to wrap a pipeline in a function, but can't get it to work:
async fn test<T: serde::de::DeserializeOwned>(client: &rustis::client::Client) -> rustis::Result<T> {
let mut pipe = client.create_pipeline();
pipe.get::<_, ()>("key1").queue();
pipe.get::<_, ()>("key2").queue();
pipe.execute().await.unwrap()
}
Calling code: let r : (String, String) = test(client).await.unwrap();
I'm getting the following error:
the trait bound `rustis::Error: Deserialize<'_>` is not satisfied
the following other types implement trait `Deserialize<'de>`:
bool
char
isize
i8
i16
i32
i64
i128
and 193 others
required for `Result<T, rustis::Error>` to implement `for<'de> Deserialize<'de>`
required for `Result<T, rustis::Error>` to implement `DeserializeOwned`
Michaël Catanzariti commented
I'm not in front a computer but I would say that if you remove the unwrap()
it would work.
immerhart commented
omg