pub struct LayoutEngine { /* private fields */ }Expand description
Renders HTML layout templates using MiniJinja.
The engine always includes a built-in "default" layout. Additional layouts
are loaded from {templates_path}/layouts/*.html at construction time and
override the built-in if they share the same name.
Auto-escaping is disabled because the content variable is already rendered HTML.
Implementations§
Source§impl LayoutEngine
impl LayoutEngine
Sourcepub fn try_new(templates_path: &str) -> Result<Self, Error>
pub fn try_new(templates_path: &str) -> Result<Self, Error>
Create a LayoutEngine that loads custom .html layouts from
{templates_path}/layouts/ in addition to the built-in "default" layout.
Returns an error if any layout file contains invalid template syntax.
Sourcepub fn builtin_only() -> Self
pub fn builtin_only() -> Self
Create a LayoutEngine with only the built-in "default" layout.
Useful in tests or when no custom layouts are needed.
Auto Trait Implementations§
impl !Freeze for LayoutEngine
impl !RefUnwindSafe for LayoutEngine
impl Send for LayoutEngine
impl Sync for LayoutEngine
impl Unpin for LayoutEngine
impl UnsafeUnpin for LayoutEngine
impl !UnwindSafe for LayoutEngine
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