pub struct Template { /* private fields */ }Expand description
Struct representing a rust_html template. Enables easy reusability and injection safety.
Create one using the rust_html::rhtml! macro:
use rust_html::{rhtml, Template};
let my_template: Template = rhtml! { "<div>Hello!</div> "};You can convert a template to a HTML string:
use rust_html::{rhtml, Template};
let template = rhtml! { "<div>hello, world</div>"};
let html: String = template.into();You should typically only do this just before returning the HTML in your endpoint.
Implementations§
Trait Implementations§
Source§impl FromIterator<Template> for TemplateGroup
impl FromIterator<Template> for TemplateGroup
impl Eq for Template
impl StructuralPartialEq for Template
Auto Trait Implementations§
impl Freeze for Template
impl RefUnwindSafe for Template
impl Send for Template
impl Sync for Template
impl Unpin for Template
impl UnwindSafe for Template
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