Function format

Source
pub fn format()
Expand description

Formats arguments according to the specified format

The first argument to this filter must be a string literal (as in normal Rust). All arguments are passed through to the format!() macro by the Askama code generator.

{{ "{:?}{:?}"|format(value, other_value) }}
/// ```jinja
/// <div>{{ "{:?}"|format(value) }}</div>
/// ```
#[derive(Template)]
#[template(ext = "html", in_doc = true)]
struct Example {
    value: (usize, usize),
}

assert_eq!(
    Example { value: (3, 4) }.to_string(),
    "<div>(3, 4)</div>"
);

Compare with fmt.