From 03d92fd370fe86823c6f62c42ca0755926aadaf1 Mon Sep 17 00:00:00 2001 From: Peter Sonntag Date: Fri, 18 Oct 2024 17:40:57 +0200 Subject: [PATCH 1/3] harmonize messages --- examples/simple_manual.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/simple_manual.rs b/examples/simple_manual.rs index a9b6766..100275d 100644 --- a/examples/simple_manual.rs +++ b/examples/simple_manual.rs @@ -11,7 +11,7 @@ struct AppModel { #[derive(Debug)] // ANCHOR: msg -enum AppInput { +enum AppMsg { Increment, Decrement, } @@ -30,7 +30,7 @@ impl SimpleComponent for AppModel { // ANCHOR: constants /// The type of the messages that this component can receive. - type Input = AppInput; + type Input = AppMsg; /// The type of the messages that this component can send. type Output = (); /// The type of data with which this component will be initialized. @@ -102,10 +102,10 @@ impl SimpleComponent for AppModel { // ANCHOR: update_function fn update(&mut self, message: Self::Input, _sender: ComponentSender) { match message { - AppInput::Increment => { + AppMsg::Increment => { self.counter = self.counter.wrapping_add(1); } - AppInput::Decrement => { + AppMsg::Decrement => { self.counter = self.counter.wrapping_sub(1); } } From 298752ce5b8bd49afcae70d5c747ee7bf12c9cb8 Mon Sep 17 00:00:00 2001 From: Peter Sonntag Date: Sun, 20 Oct 2024 10:54:04 +0200 Subject: [PATCH 2/3] update tracker version --- src/efficient_ui/tracker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/efficient_ui/tracker.md b/src/efficient_ui/tracker.md index eb546a6..6568176 100644 --- a/src/efficient_ui/tracker.md +++ b/src/efficient_ui/tracker.md @@ -37,7 +37,7 @@ To reset all previous changes, you can call `{struct_var_name}.reset()`. First we have to add the tracker library to `Cargo.toml`: ```toml -tracker = "0.1" +tracker = "0.2.2" ``` Now let's have a look at a small example. From 49ce678f673eecc6108e24863d2a20478d46dd8f Mon Sep 17 00:00:00 2001 From: Peter Sonntag Date: Sun, 20 Oct 2024 10:57:11 +0200 Subject: [PATCH 3/3] Suggestion on better headline --- src/efficient_ui/tracker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/efficient_ui/tracker.md b/src/efficient_ui/tracker.md index 6568176..2fb9a02 100644 --- a/src/efficient_ui/tracker.md +++ b/src/efficient_ui/tracker.md @@ -33,7 +33,7 @@ To check for changes you can call `{struct_var_name}.changed(StructName::{field_ To reset all previous changes, you can call `{struct_var_name}.reset()`. -## Example +## A tracker example First we have to add the tracker library to `Cargo.toml`: ```toml