Trait build_html::Html

source ·
pub trait Html: Debug {
    // Required method
    fn to_html_string(&self) -> String;
}
Expand description

An element that can be converted to an HTML string

This trait is the centerpiece of the entire library: after building up an HTML structure, usually an HtmlPage, to_html_string() is used to flush the structure to a string.

Required Methods§

source

fn to_html_string(&self) -> String

Convert this element into an HTML string

This is the method that ultimately flushes each HTML object to a string.

Example
let html = Container::default()
    .with_paragraph("My p element")
    .to_html_string();

assert_eq!(html, "<div><p>My p element</p></div>");

Trait Implementations§

source§

impl Display for dyn Html

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementations on Foreign Types§

source§

impl Html for String

source§

impl Html for &str

Implementors§