scope

Function scope 

Source
pub fn scope<R, F: FnOnce(&Scope) -> R>(f: F) -> R
Expand description

Invokes a function with a reference to the stack scope so values can be borrowed.

use minijinja::render;

let items = [1u32, 2, 3, 4];
let rv = scope(|scope| {
    render!("items: {{ items }}", items => scope.seq_object_ref(&items[..]))
});
assert_eq!(rv, "items: [1, 2, 3, 4]");