Skip to main content

TemplateRenderer

Trait TemplateRenderer 

Source
pub trait TemplateRenderer {
    // Required methods
    fn render_str(&self, template: &str, context: &Value) -> Result<String>;
    fn render_value(&self, value: &Value, context: &Value) -> Result<Value>;
}
Expand description

Trait abstracting template rendering so protocol crates can render strings and JSON values without depending on a specific engine.

Required Methods§

Source

fn render_str(&self, template: &str, context: &Value) -> Result<String>

Render a template string with the given context, returning the raw string.

Source

fn render_value(&self, value: &Value, context: &Value) -> Result<Value>

Render a JSON value, recursively expanding any template strings.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§