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§
sourcefn 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()
.with_paragraph("My p element")
.to_html_string();
assert_eq!(html, "<div><p>My p element</p></div>");