Trait DefaultTemplate

Source
pub trait DefaultTemplate: Template {
    const RAW_TEMPLATE: &'static str;

    // Provided method
    fn render_default(&self, options: &Options) -> Result<Serialized> { ... }
}
Expand description

A Template with an attached default template.

Create this automatically with #[default_template("myfile.js") on your Template struct.

Required Associated Constants§

Source

const RAW_TEMPLATE: &'static str

The raw static string with the templates contents.

When using #[default_template("myfile.js")] it will be generated as include_str!("myfile.js").

Provided Methods§

Source

fn render_default(&self, options: &Options) -> Result<Serialized>

Render the serialized template data into the default template.

If this method is implemented manually, it still needs to use Template::render to be serialized correctly.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§