pub trait SemanticElement {
// Required method
fn build(&self) -> String;
}Expand description
Trait implemented by all semantic element builders.
Each of Article, Section, Nav, and Aside expose the
same fluent setters via a shared macro implementation; this trait
is the polymorphic seam used when callers want to render any of
them through a single API.
§Examples
use html_generator::elements::{Article, SemanticElement};
fn render<E: SemanticElement>(e: &E) -> String {
e.build()
}
let html = render(&Article::new().id("a").child("<p>x</p>"));
assert!(html.contains("<article"));