This library represents HTML in types. The <p> tag turns into a typed_html::elements::p [1], inside of which the attributes are held by a typed_html::elements::Attrs_p [2].
[1] https://docs.rs/typed-html/0.1.0/typed_html/elements/struct....
[2] https://docs.rs/typed-html/0.1.0/typed_html/elements/struct....
let doc: DOMTree<String> = html!{
<body>
<img alt="xxx" />
<p alt="xxx"></p>
</body>
};
If you try to give <p> an alt attribute, the program fails to compile.
error[E0609]: no field `alt` on type `typed_html::elements::Attrs_p`
--> src/main.rs:12:16
|
12 | <p alt="xxx"></p>
| ^^^ unknown field
|
= note: available fields are: `accesskey`, `autocapitalize`, `class`, `contenteditable`, `contextmenu` ... and 9 others