Struct skyline_web::Ramhorns
source · pub struct Ramhorns { /* private fields */ }
Expand description
Aggregator for Template
s, that allows them to
be loaded from the file system and use partials: {{>partial}}
Implementations
sourceimpl Ramhorns
impl Ramhorns
sourcepub fn from_folder<P>(dir: P) -> Result<Ramhorns, Error>where
P: AsRef<Path>,
pub fn from_folder<P>(dir: P) -> Result<Ramhorns, Error>where
P: AsRef<Path>,
Loads all the .html
files as templates from the given folder, making them
accessible via their path, joining partials as required.
let tpls = Ramhorns::from_folder("./templates").unwrap();
let content = "I am the content";
let rendered = tpls.get("hello.html").unwrap().render(&content);
sourcepub fn lazy<P>(dir: P) -> Result<Ramhorns, Error>where
P: AsRef<Path>,
pub fn lazy<P>(dir: P) -> Result<Ramhorns, Error>where
P: AsRef<Path>,
Create a new empty aggregator for a given folder. This won’t do anything until
a template has been added using from_file
.
let mut tpls = Ramhorns::lazy("./templates").unwrap();
let content = "I am the content";
let rendered = tpls.from_file("hello.html").unwrap().render(&content);
Auto Trait Implementations
impl RefUnwindSafe for Ramhorns
impl Send for Ramhorns
impl Sync for Ramhorns
impl Unpin for Ramhorns
impl UnwindSafe for Ramhorns
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more