on master help sign in
examples/hello-world: use the builder for rendering
commitc0da61a5ed0d085f9bb4d847d087b816a5d43caa authorNick Fitzgerald <fitzgen@gmail.com> dateWed 13 Feb 2019, 08:40 (8 years ago) parentf3b0625
1 file changed+4−11
examples/hello-world/src/lib.rs+4−11
examples/hello-world/src/lib.rs+4−11
@@ -15,17 +15,10 @@ impl<'who> Render for Hello<'who> {
1515 where
1616 'a: 'bump,
1717 {
18− Node::element(
19− bump,
20− // The element's tag name. In this case a `<p>` element.
21− "p",
22− // Event listeners. Empty in this case.
23− [],
24− // Attributes. Again, empty in this case.
25− [],
26− // Child nodes.
27− [Node::text("Hello, "), Node::text(self.who), Node::text("!")],
28− )
18+ use dodrio::builder::*;
19+ p(bump)
20+ .children([text("Hello, "), text(self.who), text("!")])
21+ .finish()
2922 }
3023}
3124