pub struct TemplateEngine { /* private fields */ }Expand description
Handlebars registry with templates loaded at startup.
Implementations§
Source§impl TemplateEngine
impl TemplateEngine
Sourcepub fn from_config(config: &Config) -> Result<Self, OrbitError>
pub fn from_config(config: &Config) -> Result<Self, OrbitError>
Loads and pre-compiles every .hbs file under template_dir.
§Errors
Returns OrbitError::Template when templates cannot be read or compiled.
Sourcepub fn render_page(
&self,
page: CompiledPage,
output_root: &Path,
) -> Result<RenderedPage, PageError>
pub fn render_page( &self, page: CompiledPage, output_root: &Path, ) -> Result<RenderedPage, PageError>
Wraps a compiled page fragment in the site layout.
Auto Trait Implementations§
impl !RefUnwindSafe for TemplateEngine
impl !UnwindSafe for TemplateEngine
impl Freeze for TemplateEngine
impl Send for TemplateEngine
impl Sync for TemplateEngine
impl Unpin for TemplateEngine
impl UnsafeUnpin 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