macro_rules! box_html {
($($inner:tt)*) => { ... };
}Expand description
Create a new owned html template.
This template will be boxed and will own it’s environment. If you need to return a template from a function, use this.
Example:
fn post<'a>(title: &'a str) -> Box<horrorshow::RenderBox + 'a> {
box_html! {
article {
title { h1 : title }
p : "This is one paragraph.";
p : "This is a second.";
}
}
}
println!("{}", html! {
html {
body {
: post("First Post");
|t| for i in 0..10 {
// Waiting for non-lexical borrows!!!!
let tmp = format!("Spam post {}", i);
let post = post(&tmp);
&mut *t << post;
};
}
}
});