Trait write_html::Html

source ·
pub trait Html {
    // Required method
    fn write_html(self, env: &mut impl HtmlEnv) -> Result;

    // Provided method
    fn is_unit(&self) -> bool { ... }
}
Expand description

Represents a content that can be written to a Write as HTML.

Required Methods§

source

fn write_html(self, env: &mut impl HtmlEnv) -> Result

Writes the HTML representation of self to w.

Arguments
  • env - The environment to write to.
Example
use write_html::{Html, HtmlEnv, AsHtml};
use std::fmt::Write;
 
let mut s = String::new();
"<h1>H1</h1>".as_html().write_html(&mut s).unwrap();
assert_eq!(s, "<h1>H1</h1>");

Provided Methods§

source

fn is_unit(&self) -> bool

Tells whether self is a unit value, meaning that it is not written.

Implementors§

source§

impl Html for DefaultMeta

source§

impl Html for Doctype

source§

impl Html for Empty

source§

impl<'n, A: Attributes, I: Html, const SILENT: bool> Html for Tag<'n, A, I, SILENT>

source§

impl<A: Html, B: Html> Html for Sum<A, B>

source§

impl<I: IntoIterator> Html for Iwhere I::Item: Html,

source§

impl<S> Html for HtmlStr<S>where S: AsRef<str>,

source§

impl<S> Html for HtmlTextStr<S>where S: AsRef<str>,