pub struct Templates { /* private fields */ }Expand description
Built-in template engine, see the module docs for the syntax
Implementations§
Source§impl Templates
impl Templates
pub fn new() -> Self
Sourcepub fn add(&mut self, name: &str, source: &str) -> Result<&mut Self>
pub fn add(&mut self, name: &str, source: &str) -> Result<&mut Self>
Parse and register a template under name
Sourcepub fn from_dir(dir: impl AsRef<Path>) -> Result<Self>
pub fn from_dir(dir: impl AsRef<Path>) -> Result<Self>
Load every .html, .htm, .txt and .xml file below dir
(recursively); the name is the path relative to dir, with /
separators, e.g. layouts/base.html.
pub fn contains(&self, name: &str) -> bool
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 UnsafeUnpin 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