dom!() { /* proc-macro */ }Expand description
Allows to create DomNode using RSX/rstml (HTML-like) syntax.
Simple DOM with a param embedded:
use vertigo::dom;
let value = "world";
dom! {
<div>
<h3>"Hello " {value} "!"</h3>
<p>"Good morning!"</p>
</div>
};Mapping and embedding an Option:
use vertigo::dom;
let name = "John";
let occupation = Some("Lumberjack");
dom! {
<div>
<h3>"Hello " {name} "!"</h3>
{..occupation.map(|occupation| dom! { <p>"Occupation: " {occupation}</p> })}
</div>
};Note the spread operator which utilizes the fact that Option is iterable in Rust.