pub struct TemplateEngine { /* private fields */ }
Expand description
Template engine for rendering HTML pages (similar to Jinja2 in Sphinx)
Implementations§
Source§impl TemplateEngine
impl TemplateEngine
pub fn new(config: &BuildConfig) -> Result<Self>
Sourcepub fn render(
&self,
template_name: &str,
context: &Map<String, Value>,
) -> Result<String>
pub fn render( &self, template_name: &str, context: &Map<String, Value>, ) -> Result<String>
Render a template with the given context
Sourcepub fn set_global_context(&mut self, context: HashMap<String, Value>)
pub fn set_global_context(&mut self, context: HashMap<String, Value>)
Set global template context
Sourcepub fn update_global_context(&mut self, key: String, value: Value)
pub fn update_global_context(&mut self, key: String, value: Value)
Update global template context
Sourcepub fn newest_template_mtime(&self) -> SystemTime
pub fn newest_template_mtime(&self) -> SystemTime
Get newest template modification time
Sourcepub fn newest_template_name(&self) -> String
pub fn newest_template_name(&self) -> String
Get newest template name (for logging)
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more