pub struct Template { /* private fields */ }Expand description
A rendered template split into static and dynamic segments.
Static segments are trusted template literals. Dynamic segments are escaped
before rendering, which gives the v1 template macro a safe default while
keeping v0 Html as the final transport shape.
Implementations§
Source§impl Template
impl Template
Sourcepub fn new(
static_segments: Vec<&'static str>,
dynamic_segments: Vec<String>,
) -> Self
pub fn new( static_segments: Vec<&'static str>, dynamic_segments: Vec<String>, ) -> Self
Construct a segmented template.
Sourcepub fn static_segments(&self) -> &[&'static str]
pub fn static_segments(&self) -> &[&'static str]
Borrow trusted static template segments.
Sourcepub fn dynamic_segments(&self) -> &[String]
pub fn dynamic_segments(&self) -> &[String]
Borrow escaped dynamic template segments.
Sourcepub fn render_string(&self) -> String
pub fn render_string(&self) -> String
Render this template into a raw HTML string.
Trait Implementations§
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 UnsafeUnpin 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