pub struct EngineBuilder { /* private fields */ }Expand description
Builder for Engine.
Obtained via Engine::builder(). Call EngineBuilder::build to construct
the engine after setting options.
Implementations§
Source§impl EngineBuilder
impl EngineBuilder
Sourcepub fn config(self, config: TemplateConfig) -> Self
pub fn config(self, config: TemplateConfig) -> Self
Sets the template configuration.
If not called, TemplateConfig::default() is used.
Sourcepub fn function<N, F, Rv, Args>(self, name: N, f: F) -> Selfwhere
N: Into<Cow<'static, str>> + Send + 'static,
F: Function<Rv, Args> + Send + Sync + 'static,
Rv: FunctionResult,
Args: for<'a> FunctionArgs<'a>,
pub fn function<N, F, Rv, Args>(self, name: N, f: F) -> Selfwhere
N: Into<Cow<'static, str>> + Send + 'static,
F: Function<Rv, Args> + Send + Sync + 'static,
Rv: FunctionResult,
Args: for<'a> FunctionArgs<'a>,
Registers a custom MiniJinja global function.
name is the name used in templates (e.g. "greet"), f is any value that
implements minijinja::functions::Function.
Sourcepub fn filter<N, F, Rv, Args>(self, name: N, f: F) -> Selfwhere
N: Into<Cow<'static, str>> + Send + 'static,
F: Function<Rv, Args> + Send + Sync + 'static,
Rv: FunctionResult,
Args: for<'a> FunctionArgs<'a>,
pub fn filter<N, F, Rv, Args>(self, name: N, f: F) -> Selfwhere
N: Into<Cow<'static, str>> + Send + 'static,
F: Function<Rv, Args> + Send + Sync + 'static,
Rv: FunctionResult,
Args: for<'a> FunctionArgs<'a>,
Registers a custom MiniJinja filter.
name is the filter name used in templates (e.g. "shout"), f is any value
that implements minijinja::functions::Function.
Sourcepub fn locale_resolvers(self, resolvers: Vec<Arc<dyn LocaleResolver>>) -> Self
pub fn locale_resolvers(self, resolvers: Vec<Arc<dyn LocaleResolver>>) -> Self
Overrides the locale resolver chain.
The resolvers are tried in order; the first one that returns Some wins.
When not called, a default chain of QueryParamResolver,
CookieResolver,
AcceptLanguageResolver, and (when the session
feature is enabled) SessionResolver is used.