Trait 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

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: Iterator> Html for I
where 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>,