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 dyn_write_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§

source

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

Helper method which allocates a new String and renders into it

source

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

Renders the template to the given writer fmt buffer

source

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

Renders the template to the given writer io buffer

source

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

Helper function to inspect the template’s extension

source

fn size_hint(&self) -> usize

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

source

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

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

Trait Implementations§

source§

impl Display for dyn DynTemplate

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementors§