Trait DynTemplate

Source
pub trait DynTemplate {
    // Required methods
    fn dyn_render(&self) -> Result<String>;
    fn dyn_render_with_values(&self, values: &dyn Values) -> Result<String>;
    fn dyn_render_into(&self, writer: &mut dyn Write) -> Result<()>;
    fn dyn_render_into_with_values(
        &self,
        writer: &mut dyn Write,
        values: &dyn Values,
    ) -> Result<()>;
    fn dyn_write_into(&self, writer: &mut dyn Write) -> Result<()>;
    fn dyn_write_into_with_values(
        &self,
        writer: &mut dyn Write,
        values: &dyn Values,
    ) -> Result<()>;
    fn size_hint(&self) -> usize;
}
Expand description

dyn-compatible wrapper trait around Template implementers

This trades reduced performance (mostly due to writing into dyn Write) for dyn-compatibility.

Required Methods§

Source

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

Helper method which allocates a new String and renders into it.

Source

fn dyn_render_with_values(&self, values: &dyn Values) -> Result<String>

Helper method which allocates a new String and renders into it with provided Values.

Source

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

Renders the template to the given writer fmt buffer.

Source

fn dyn_render_into_with_values( &self, writer: &mut dyn Write, values: &dyn Values, ) -> Result<()>

Renders the template to the given writer fmt buffer with provided Values.

Source

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

Renders the template to the given writer io buffer.

Source

fn dyn_write_into_with_values( &self, writer: &mut dyn Write, values: &dyn Values, ) -> Result<()>

Renders the template to the given writer io buffer with provided Values.

Source

fn size_hint(&self) -> usize

Provides a conservative estimate of the expanded length of the rendered 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§