macro_rules! context {
(
$($key:ident $(=> $value:expr)?),* $(,)?
) => { ... };
}
Expand description
Creates a template context with keys and values.
let ctx = context! {
name => "Peter",
location => "World",
};
Alternatively if the variable name matches the key name it can be omitted:
let name = "Peter";
let ctx = context! { name };
The return value is a Value
.