Function rocket_dyn_templates::minijinja::path_loader
source · pub fn path_loader<'x, P>(
dir: P,
) -> impl for<'a> Fn(&'a str) + Send + Sync + 'static
Expand description
Helper to load templates from a given directory.
This creates a dynamic loader which looks up templates in the
given directory. Templates that start with a dot (.
) or are contained in
a folder starting with a dot cannot be loaded.
§Example
fn create_env() -> Environment<'static> {
let mut env = Environment::new();
env.set_loader(path_loader("path/to/templates"));
env
}