pub struct Template {
pub slug: String,
pub name: String,
pub subject: String,
pub html_body: String,
pub text_body: String,
pub variables: Vec<String>,
}Expand description
A reusable message template with variable placeholders.
Fields§
§slug: StringUnique identifier for looking up this template.
name: StringHuman-readable template name.
subject: StringSubject line template (rendered with variables).
html_body: StringHTML body template.
text_body: StringPlain text body template.
variables: Vec<String>List of expected variable names (for documentation/validation).
Implementations§
Source§impl Template
impl Template
Sourcepub fn render(
&self,
variables: &HashMap<String, String>,
) -> Result<RenderedTemplate, ChorusError>
pub fn render( &self, variables: &HashMap<String, String>, ) -> Result<RenderedTemplate, ChorusError>
Renders the template by replacing placeholders with provided values.
Supports Jinja2 syntax: {{ variable }}, {% if %}, {% for %}, filters.
Simple {{variable}} from prior versions remains compatible.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Template
impl<'de> Deserialize<'de> for Template
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Template
impl RefUnwindSafe for Template
impl Send for Template
impl Sync for Template
impl Unpin for Template
impl UnsafeUnpin for Template
impl UnwindSafe for Template
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more