Trait askama::Template

source ·
pub trait Template {
    const EXTENSION: Option<&'static str>;
    const SIZE_HINT: usize;
    const MIME_TYPE: &'static str;

    // Required method
    fn render_into(&self, writer: &mut (impl Write + ?Sized)) -> Result<()>;

    // Provided method
    fn render(&self) -> Result<String> { ... }
}
Expand description

Main Template trait; implementations are generally derived

If you need an object-safe template, use DynTemplate.

Required Associated Constants§

source

const EXTENSION: Option<&'static str>

The template’s extension, if provided

source

const SIZE_HINT: usize

Provides a conservative estimate of the expanded length of the rendered template

source

const MIME_TYPE: &'static str

The MIME type (Content-Type) of the data that gets rendered by this Template

Required Methods§

source

fn render_into(&self, writer: &mut (impl Write + ?Sized)) -> Result<()>

Renders the template to the given writer buffer

Provided Methods§

source

fn render(&self) -> Result<String>

Helper method which allocates a new String and renders into it

Object Safety§

This trait is not object safe.

Implementors§