pub trait TemplateSource: Send + Sync {
// Required method
fn load(
&self,
name: &str,
locale: &str,
default_locale: &str,
) -> Result<String>;
}Expand description
Trait for loading raw email templates (frontmatter + body).
Implementations must be Send + Sync for use in Arc<dyn TemplateSource>.
The returned string is the raw template content including the YAML frontmatter
block and Markdown body — parsing is handled downstream by the Mailer.
Required Methods§
Sourcefn load(&self, name: &str, locale: &str, default_locale: &str) -> Result<String>
fn load(&self, name: &str, locale: &str, default_locale: &str) -> Result<String>
Load a template by name for the given locale.
default_locale is the application-wide fallback locale, used when a
locale-specific file does not exist.
§Errors
Returns an error when no suitable template can be found for the given name and locale combination.