pub struct TemplateEngine { /* private fields */ }Expand description
Compiled template engine with pre-registered templates.
Delegates to SourceMappingEngine from drasi-source-mapping.
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
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
Sourcepub fn render_property_value(
&self,
value: &JsonValue,
context: &TemplateContext,
) -> Result<ElementValue>
pub fn render_property_value( &self, value: &JsonValue, context: &TemplateContext, ) -> Result<ElementValue>
Render a single property value (used internally by tests)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TemplateEngine
impl !RefUnwindSafe for TemplateEngine
impl !UnwindSafe for TemplateEngine
impl Send for TemplateEngine
impl Sync for TemplateEngine
impl Unpin for TemplateEngine
impl UnsafeUnpin 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