pub struct TemplateEngine { /* private fields */ }Expand description
Compiled template engine with pre-registered templates
Implementations§
Source§impl TemplateEngine
impl TemplateEngine
Sourcepub fn render_string(
&self,
template: &str,
context: &TemplateContext,
) -> Result<String>
pub fn render_string( &self, template: &str, context: &TemplateContext, ) -> Result<String>
Render a template string with the given context
Sourcepub fn render_value(
&self,
template: &str,
context: &TemplateContext,
) -> Result<JsonValue>
pub fn render_value( &self, template: &str, context: &TemplateContext, ) -> Result<JsonValue>
Render a template and preserve the JSON value type
If the template is a simple variable reference like {{payload.field}},
this returns the original JSON value. Otherwise, it returns the rendered string.
Sourcepub fn process_mapping(
&self,
mapping: &WebhookMapping,
context: &TemplateContext,
source_id: &str,
) -> Result<SourceChange>
pub fn process_mapping( &self, mapping: &WebhookMapping, context: &TemplateContext, source_id: &str, ) -> Result<SourceChange>
Process a webhook mapping and create a SourceChange
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TemplateEngine
impl !RefUnwindSafe for TemplateEngine
impl Send for TemplateEngine
impl Sync for TemplateEngine
impl Unpin for TemplateEngine
impl UnsafeUnpin for TemplateEngine
impl !UnwindSafe for TemplateEngine
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