pub trait SimpleEmailTemplate: Template {
// Provided methods
fn render_html(&self) -> Result<String, EmailError> { ... }
fn render_text(&self) -> Result<Option<String>, EmailError> { ... }
}Expand description
Helper trait for rendering both HTML and text versions from a single template
This trait provides a default implementation that uses the same template for both HTML and text. For production use, you should create separate templates for HTML and text versions.
Provided Methods§
Sourcefn render_html(&self) -> Result<String, EmailError>
fn render_html(&self) -> Result<String, EmailError>
Render the template as HTML
§Errors
Returns EmailError::TemplateError if the template fails to render
Sourcefn render_text(&self) -> Result<Option<String>, EmailError>
fn render_text(&self) -> Result<Option<String>, EmailError>
Render a plain text version
Default implementation returns None. Override this to provide
a plain text version.
§Errors
Returns EmailError::TemplateError if the template fails to render
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.