mirror of
https://github.com/danbulant/cushy
synced 2026-07-06 19:50:40 +00:00
Regenerating readmes
This commit is contained in:
parent
83e44912ee
commit
8bcbad959b
2 changed files with 10 additions and 8 deletions
|
|
@ -33,11 +33,12 @@ increments its own label:
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
// Create a dynamic usize.
|
// Create a dynamic usize.
|
||||||
let count = Dynamic::new(0_isize);
|
let count = Dynamic::new(0_isize);
|
||||||
// Create a dynamic that contains `count.to_string()`
|
|
||||||
let count_label = count.map_each(ToString::to_string);
|
|
||||||
|
|
||||||
// Create a new button whose text is our dynamic string.
|
// Create a new label displaying `count`
|
||||||
count_label
|
count
|
||||||
|
.clone()
|
||||||
|
.into_label()
|
||||||
|
// Use the label as the contents of a button
|
||||||
.into_button()
|
.into_button()
|
||||||
// Set the `on_click` callback to a closure that increments the counter.
|
// Set the `on_click` callback to a closure that increments the counter.
|
||||||
.on_click(move |_| count.set(count.get() + 1))
|
.on_click(move |_| count.set(count.get() + 1))
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,12 @@ increments its own label:
|
||||||
fn main() -> cushy::Result {
|
fn main() -> cushy::Result {
|
||||||
// Create a dynamic usize.
|
// Create a dynamic usize.
|
||||||
let count = Dynamic::new(0_isize);
|
let count = Dynamic::new(0_isize);
|
||||||
// Create a dynamic that contains `count.to_string()`
|
|
||||||
let count_label = count.map_each(ToString::to_string);
|
|
||||||
|
|
||||||
// Create a new button whose text is our dynamic string.
|
// Create a new label displaying `count`
|
||||||
count_label
|
count
|
||||||
|
.clone()
|
||||||
|
.into_label()
|
||||||
|
// Use the label as the contents of a button
|
||||||
.into_button()
|
.into_button()
|
||||||
// Set the `on_click` callback to a closure that increments the counter.
|
// Set the `on_click` callback to a closure that increments the counter.
|
||||||
.on_click(move |_| count.set(count.get() + 1))
|
.on_click(move |_| count.set(count.get() + 1))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue