Macro jvec

Source
macro_rules! jvec {
    [$($v:tt),*] => { ... };
    () => { ... };
}
Expand description

Helper macro to build a Vec<Value>

This is useful when using any of the API methods that require a Vec<Value>, as serde_json doesn’t have a way to build these.

§Example:

// Manually
let mut args = Vec::<Value>::new();
args.push(json!([1, 2, 3]));
args.push(json!(["id", "login"]));

let request = client.execute(
    "res.users",
    "read",
    args,
).send()?;

// With jvec![]:
let request = client.execute(
    "res.users",
    "read",
    jvec![
        [1, 2, 3],
        ["id", "login"]
    ]
).send()?;