pub struct AsyncTemplateRenderer { /* private fields */ }Expand description
Async template renderer for async applications
Provides async versions of all template rendering operations
Implementations§
Source§impl AsyncTemplateRenderer
impl AsyncTemplateRenderer
Sourcepub async fn with_defaults() -> Result<Self>
pub async fn with_defaults() -> Result<Self>
Create renderer with default context
Sourcepub fn with_context(self, context: TemplateContext) -> Self
pub fn with_context(self, context: TemplateContext) -> Self
Set template context
Sourcepub async fn render_str(&mut self, template: &str, name: &str) -> Result<String>
pub async fn render_str(&mut self, template: &str, name: &str) -> Result<String>
Render template string asynchronously
§Arguments
template- Template contentname- Template name for error reporting
Sourcepub async fn render_to_format(
&mut self,
template: &str,
name: &str,
format: OutputFormat,
) -> Result<String>
pub async fn render_to_format( &mut self, template: &str, name: &str, format: OutputFormat, ) -> Result<String>
Render template to specific format
§Arguments
template- Template contentname- Template nameformat- Output format
Sourcepub fn merge_user_vars(&mut self, user_vars: HashMap<String, Value>)
pub fn merge_user_vars(&mut self, user_vars: HashMap<String, Value>)
Merge user variables into context
Sourcepub fn renderer(&self) -> &TemplateRenderer
pub fn renderer(&self) -> &TemplateRenderer
Access the underlying renderer
Sourcepub fn renderer_mut(&mut self) -> &mut TemplateRenderer
pub fn renderer_mut(&mut self) -> &mut TemplateRenderer
Access the underlying renderer mutably
Auto Trait Implementations§
impl Freeze for AsyncTemplateRenderer
impl !RefUnwindSafe for AsyncTemplateRenderer
impl Send for AsyncTemplateRenderer
impl Sync for AsyncTemplateRenderer
impl Unpin for AsyncTemplateRenderer
impl !UnwindSafe for AsyncTemplateRenderer
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