Trait askama::DynTemplate

source ·
pub trait DynTemplate {
    // Required methods
    fn dyn_render(&self) -> Result<String>;
    fn dyn_render_into(&self, writer: &mut dyn Write) -> Result<()>;
    fn extension(&self) -> Option<&'static str>;
    fn size_hint(&self) -> usize;
    fn mime_type(&self) -> &'static str;
Expand description

Object-safe wrapper trait around Template implementers

This trades reduced performance (mostly due to writing into dyn Write) for object safety.

Required Methods§


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

Helper method which allocates a new String and renders into it


fn dyn_render_into(&self, writer: &mut dyn Write) -> Result<()>

Renders the template to the given writer buffer


fn extension(&self) -> Option<&'static str>

Helper function to inspect the template’s extension


fn size_hint(&self) -> usize

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


fn mime_type(&self) -> &'static str

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