pub struct HtmlBuf { /* private fields */ }Expand description
Single-buffer HTML writer avoiding intermediate format!() heap allocations.
Implementations§
Source§impl HtmlBuf
impl HtmlBuf
pub fn new() -> Self
pub fn with_capacity(capacity: usize) -> Self
Sourcepub fn raw_trusted(&mut self, html: TrustedHtml) -> &mut Self
pub fn raw_trusted(&mut self, html: TrustedHtml) -> &mut Self
Write a compile-time trusted static HTML literal.
Sourcepub fn raw_sanitized(&mut self, html: &SanitizedHtml) -> &mut Self
pub fn raw_sanitized(&mut self, html: &SanitizedHtml) -> &mut Self
Write audited dynamic HTML (e.g. syntax-highlighted lines or sanitized Markdown).
Sourcepub fn push(&mut self, node: impl Render) -> &mut Self
pub fn push(&mut self, node: impl Render) -> &mut Self
Render any Render value directly into this buffer.
Sourcepub fn el(
&mut self,
tag: &'static str,
attrs: &[Attr<'_>],
children: impl Render,
) -> &mut Self
pub fn el( &mut self, tag: &'static str, attrs: &[Attr<'_>], children: impl Render, ) -> &mut Self
Write a normal HTML element <tag ...attrs>children</tag>.
Sourcepub fn void_el(&mut self, tag: &'static str, attrs: &[Attr<'_>]) -> &mut Self
pub fn void_el(&mut self, tag: &'static str, attrs: &[Attr<'_>]) -> &mut Self
Write an HTML void element (<input ...>, <meta ...>, <link ...>, <img ...>).
pub fn as_str(&self) -> &str
Trait Implementations§
Auto Trait Implementations§
impl Forget for HtmlBuf
impl Freeze for HtmlBuf
impl Move for HtmlBuf
impl RefUnwindSafe for HtmlBuf
impl Send for HtmlBufwhere
RawVecInner: Send,
impl Sync for HtmlBufwhere
RawVecInner: Sync,
impl Unpin for HtmlBuf
impl UnsafeUnpin for HtmlBuf
impl UnwindSafe for HtmlBufwhere
RawVecInner: UnwindSafe,
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