pub struct HtmlEscaper<'a, W: Write> { /* private fields */ }
Expand description
Escapes a string for the inside of an HTML element.
§Examples
use std::fmt::Write;
use write_html::escapes::HtmlEscaper;
let mut s = String::new();
let mut escaper = HtmlEscaper::new(&mut s);
escaper.write_str("<h1>H1</h1>").unwrap();
assert_eq!(s, "<h1>H1</h1>");
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'a, W> Freeze for HtmlEscaper<'a, W>
impl<'a, W> RefUnwindSafe for HtmlEscaper<'a, W>where
W: RefUnwindSafe,
impl<'a, W> Send for HtmlEscaper<'a, W>where
W: Send,
impl<'a, W> Sync for HtmlEscaper<'a, W>where
W: Sync,
impl<'a, W> Unpin for HtmlEscaper<'a, W>
impl<'a, W> !UnwindSafe for HtmlEscaper<'a, W>
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
Source§impl<W> HtmlEnv for Wwhere
W: Write,
impl<W> HtmlEnv for Wwhere
W: Write,
Source§fn write_html_text<'s>(&'s mut self) -> HtmlEscaper<'s, Self>
fn write_html_text<'s>(&'s mut self) -> HtmlEscaper<'s, Self>
Lets you write text into the HTML document, escaping it as necessary. Read more
Source§fn open_tag<'s, 't>(
&'s mut self,
tag: &'t str,
compactability: Compactability,
) -> Result<TagOpening<'s, 't, Self>, Error>
fn open_tag<'s, 't>( &'s mut self, tag: &'t str, compactability: Compactability, ) -> Result<TagOpening<'s, 't, Self>, Error>
Returns a tag opening, which lets you write attributes and inner HTML. Read more