Skip to content

Commit

Permalink
examples/sync-counter.rs: update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Dec 15, 2023
1 parent a2cd58a commit 6f2e884
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions examples/sync-counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,18 @@ impl kas::app::AppData for Count {
}

fn counter(title: &str) -> Window<Count> {
// Per window state: (count, step).
// Per window state: (count, increment).
// We must store a local copy of the count in order to have a Data instance
// to pass by reference.
// (Eventually we may be able to support Adapt forwarding data by reference,
// but this would require Rust to support object-safe GATs.)
type Data = (Count, i32);
// Initial count is replaced during configure, but initial step is used.
// Initial count is replaced during configure, but initial increment is used.
let initial: Data = (Count(0), 1);

#[derive(Clone, Debug)]
struct SetValue(i32);

// let slider = Slider::<_, _>::new_msg(1..=10, |data: &Data| data.1, SetValue);
let slider = Slider::right(1..=10, |_, data: &Data| data.1).with_msg(SetValue);
let ui = kas::column![
format_data!(data: &Data, "Count: {}", data.0.0),
Expand Down

0 comments on commit 6f2e884

Please sign in to comment.