pub struct RenderOptions {
pub template: String,
pub version_id: Option<String>,
pub template_data: HashMap<String, Value>,
pub strict: bool,
pub locale: Option<String>,
}
Expand description
Options for rendering an email template without sending it.
This struct is used with the render API endpoint to preview how a template will look with specific data. This is useful for testing templates and generating email content for use in other systems.
§Examples
use send_with_us::types::RenderOptions;
use std::collections::HashMap;
use serde_json::json;
let mut template_data = HashMap::new();
template_data.insert("name".to_string(), json!("John"));
template_data.insert("order_id".to_string(), json!("12345"));
let options = RenderOptions {
template: "template-id".to_string(),
version_id: Some("version-id".to_string()),
template_data,
strict: true,
locale: Some("en-US".to_string()),
};
Fields§
§template: String
ID of the template to render
version_id: Option<String>
Optional specific version of the template to render
template_data: HashMap<String, Value>
Data to use when rendering template variables
strict: bool
Whether to use strict mode for variable replacement (error on missing variables vs. leaving them as is)
locale: Option<String>
Locale for template internationalization
Trait Implementations§
Source§impl Clone for RenderOptions
impl Clone for RenderOptions
Source§fn clone(&self) -> RenderOptions
fn clone(&self) -> RenderOptions
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for RenderOptions
impl Debug for RenderOptions
Source§impl<'de> Deserialize<'de> for RenderOptions
impl<'de> Deserialize<'de> for RenderOptions
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
Source§impl PartialEq for RenderOptions
impl PartialEq for RenderOptions
Source§impl Serialize for RenderOptions
impl Serialize for RenderOptions
impl StructuralPartialEq for RenderOptions
Auto Trait Implementations§
impl Freeze for RenderOptions
impl RefUnwindSafe for RenderOptions
impl Send for RenderOptions
impl Sync for RenderOptions
impl Unpin for RenderOptions
impl UnwindSafe for RenderOptions
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