Skip to main content

Template

Trait Template 

Source
pub trait Template: Send + Sync {
    // Required method
    fn render(
        &self,
        data: &Value,
        locale: &str,
    ) -> Result<Rendered, TemplateError>;
}
Expand description

One template. data is the caller’s JSON payload; locale is the requested locale tag (en, de, …) used by the implementation for its own variants.

Required Methods§

Source

fn render(&self, data: &Value, locale: &str) -> Result<Rendered, TemplateError>

§Errors

Err when the template cannot render data (missing fields, …).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§