[−][src]Macro redis_async::resp_array
Macro to create a RESP array, useful for preparing commands to send. Elements can be any type, or a mixture
of types, that satisfy Into<RespValue>
.
As a general rule, if a value is moved, the data can be deconstructed (if appropriate, e.g. String) and the raw
data moved into the corresponding RespValue
. If a reference is provided, the data will be copied instead.
Examples
#[macro_use] extern crate redis_async; fn main() { let value = format!("something_{}", 123); resp_array!["SET", "key_name", value]; }
For variable length Redis commands:
#[macro_use] extern crate redis_async; fn main() { let data = vec!["data", "from", "somewhere", "else"]; let command = resp_array!["RPUSH", "mykey"].append(data); }