Function center

Source
pub fn center<T: Display>(src: T, width: usize) -> Result<Center<T>, Infallible>
Expand description

Centers the value in a field of a given width

/// ```jinja
/// <div>-{{ example|center(5) }}-</div>
/// ```
#[derive(Template)]
#[template(ext = "html", in_doc = true)]
struct Example<'a> {
    example: &'a str,
}

assert_eq!(
    Example { example: "a" }.to_string(),
    "<div>-  a  -</div>"
);