pub struct TEMPLATES { /* private fields */ }
Methods from Deref<Target = Tera>§
Sourcepub fn check_macro_files(&self) -> Result<(), Error>
pub fn check_macro_files(&self) -> Result<(), Error>
We keep track of macro files loaded in each Template so we can know whether one or them is missing and error accordingly before the user tries to render a template.
As with self::build_inheritance_chains
, you don’t usually need to call that yourself.
Sourcepub fn render(
&self,
template_name: &str,
context: &Context,
) -> Result<String, Error>
pub fn render( &self, template_name: &str, context: &Context, ) -> Result<String, Error>
Renders a Tera template given a tera::Context
,
To render a template with an empty context, simply pass a new tera::Context
object
ⓘ
// Rendering a template with a normal context
let mut context = Context::new();
context.insert("age", 18);
tera.render("hello.html", context);
// Rendering a template with an empty context
tera.render("hello.html", Context::new());
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TEMPLATES
impl RefUnwindSafe for TEMPLATES
impl Send for TEMPLATES
impl Sync for TEMPLATES
impl Unpin for TEMPLATES
impl UnwindSafe for TEMPLATES
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