Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
matthunz committed Sep 24, 2023
2 parents 3f9ec67 + 9246f09 commit ef99aad
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ but you can bring your own state management tools or build your own framework us
### Hello World
```rust
let mut tree = Tree::default();
let root = Element::builder()
let root = Element::new()
.align_items(AlignItems::Center)
.justify_content(JustifyContent::Center)
.child(tree.insert("Hello World!"))
Expand All @@ -53,10 +53,10 @@ viewbuilder::run(tree, root)
fn button(
tree: &mut Tree,
label: &'static str,
mut f: impl FnMut(&mut Tree) + 'static,
mut handler: impl FnMut(&mut Tree) + 'static,
) -> ElementKey {
Element::builder()
.on_click(Box::new(move |tree, _event| f(tree)))
Element::new()
.on_click(Box::new(move |tree, _event| handler(tree)))
.background_color(Color4f::new(1., 1., 0., 1.))
.child(tree.insert(label))
.build(tree)
Expand Down

0 comments on commit ef99aad

Please sign in to comment.