Macro fill_query

Source
macro_rules! fill_query {
    ($options:expr, $($field:ident),*) => { ... };
}
Expand description

Macro to fill a vector<(str,str)> with a structure where fields can be optional

struct Foo<'a> {
    a: Option<'a str>
    b: Option<'a str>
}

let foo = Foo {a: "baz", b: "bar"}

will convert to

let query = fill_query!(foo, a, b);
println!("{:?}", query); // [("a", "baz"), ("b", "bar")]