#[non_exhaustive]pub struct FilterEnv {
pub timezone: Tz,
pub page: Option<Value>,
pub kwargs: Vec<(String, Value)>,
pub input_safe: bool,
pub args_safe: Vec<bool>,
/* private fields */
}Expand description
What an engine-neutral filter can see of the build and of the call.
Liquid builds one with FilterEnv::new, which leaves everything past
the time zone empty, so its filters behave as before. Nunjucks fills in
the rest.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.timezone: TzThe zone a Date input is printed in, as JavaScript’s String(date)
prints it.
page: Option<Value>The page’s data, which a JavaScript filter reads as this.page.
kwargs: Vec<(String, Value)>The keyword arguments of the call, in the order written. Nunjucks
also passes them as a last object argument, with __keywords: true,
which stays in the arguments a filter gets; this is the same data
taken apart. Liquid passes none here.
input_safe: boolThe input is a SafeString (from safe, escape or a macro). The
filter gets its text as a string, as String(input) would give it.
args_safe: Vec<bool>Which of the arguments are SafeStrings, by position.
Implementations§
Source§impl FilterEnv
impl FilterEnv
pub fn new(timezone: Tz) -> Self
Sourcepub fn returns_input(&self)
pub fn returns_input(&self)
A filter calls this when the value it returns is the input object
itself, as JavaScript’s return input is. Nunjucks then keeps a
SafeString input safe. A filter that builds a new string, even an
equal one, must not call it.
Sourcepub fn did_return_input(&self) -> bool
pub fn did_return_input(&self) -> bool
Whether the filter called FilterEnv::returns_input.