Trait build_html::Html [−][src]
pub trait Html: Debug { 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
fn to_html_string(&self) -> String
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() .add_paragraph("My p element") .to_html_string(); assert_eq!(html, "<div><p>My p element</p></div>")