pub struct TemplateBuilder { /* private fields */ }Expand description
Template builder for fluent configuration
Provides a simple, chainable API for template rendering:
use clnrm_template::TemplateBuilder;
let result = TemplateBuilder::new()
.template("Hello {{ name }}!")
.variable("name", "World")
.variable("count", "42")
.format(OutputFormat::Plain)
.render()
.unwrap();Implementations§
Source§impl TemplateBuilder
impl TemplateBuilder
Sourcepub fn variable<K: Into<String>, V: Into<String>>(
self,
key: K,
value: V,
) -> Self
pub fn variable<K: Into<String>, V: Into<String>>( self, key: K, value: V, ) -> Self
Add string variable
Sourcepub fn json_variable<K: Into<String>>(self, key: K, value: Value) -> Self
pub fn json_variable<K: Into<String>>(self, key: K, value: Value) -> Self
Add JSON variable
Sourcepub fn format(self, format: OutputFormat) -> Self
pub fn format(self, format: OutputFormat) -> Self
Set output format
Sourcepub fn context(self, context: TemplateContext) -> Self
pub fn context(self, context: TemplateContext) -> Self
Set custom context
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TemplateBuilder
impl RefUnwindSafe for TemplateBuilder
impl Send for TemplateBuilder
impl Sync for TemplateBuilder
impl Unpin for TemplateBuilder
impl UnwindSafe for TemplateBuilder
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