pub struct TemplateEngine { /* private fields */ }Expand description
Template engine for rendering templates
Implementations§
Source§impl TemplateEngine
impl TemplateEngine
Sourcepub fn render_template(
&self,
name: &str,
vars: &HashMap<String, String>,
) -> Result<String>
pub fn render_template( &self, name: &str, vars: &HashMap<String, String>, ) -> Result<String>
Render a template by name
Sourcepub fn render(
&self,
template_str: &str,
vars: &HashMap<String, String>,
) -> Result<String>
pub fn render( &self, template_str: &str, vars: &HashMap<String, String>, ) -> Result<String>
Render a template string directly (without registration)
Sourcepub fn list_templates(&self) -> Vec<&str>
pub fn list_templates(&self) -> Vec<&str>
List all registered templates
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 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