Macro dominator::props

source ·
macro_rules! props {
    ($this:ident, $($rest:tt)*) => { ... };
}
Expand description

A convenient shorthand for multiple .prop(...) calls.

Instead of writing this…

html!("div", {
    .prop("foo", "bar")
    .prop("qux", "corge")
    .prop("yes", "no")
})

…you can instead write this:

html!("div", {
    .props! {
        foo: "bar",
        qux: "corge",
        yes: "no",
    }
})

You can also use string literals as keys:

html!("div", {
    .props! {
        foo: "bar",
        "qux-corge": "Qux",
    }
})