counter2/
counter2.rs

1use rui::*;
2
3fn main() {
4    rui(state(
5        || 1,
6        |count, cx| {
7            vstack((
8                format!("{}", cx[count]).padding(Auto),
9                button("increment", move |cx| {
10                    cx[count] += 1;
11                })
12                .padding(Auto),
13                button("decrement", move |cx| {
14                    cx[count] -= 1;
15                })
16                .padding(Auto),
17            ))
18        },
19    ));
20}