macro_rules! context {
(
$(
$key:ident $(=> $value:expr)? $(,)*
)*
) => { ... };
}Expand description
Creates a context from key value pairs
A bare key captures the local variable of the same name, like in struct initializers.
Example:
use tera::context;
let age = 24;
let ctx = context! {
name => "Brian",
age,
};Expands to:
use tera::Context;
let age = 24;
let ctx = {
let mut context = Context::new();
context.insert("name", "Brian");
context.insert("age", &age);
context
};