Skip to content

Commit

Permalink
Merge pull request #76 from Relm4/harmonize_examples
Browse files Browse the repository at this point in the history
harmonize first examples
  • Loading branch information
AaronErhardt authored Oct 25, 2024
2 parents 7dc5cb8 + 49ce678 commit 253b3cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions examples/simple_manual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct AppModel {

#[derive(Debug)]
// ANCHOR: msg
enum AppInput {
enum AppMsg {
Increment,
Decrement,
}
Expand All @@ -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.
Expand Down Expand Up @@ -102,10 +102,10 @@ impl SimpleComponent for AppModel {
// ANCHOR: update_function
fn update(&mut self, message: Self::Input, _sender: ComponentSender<Self>) {
match message {
AppInput::Increment => {
AppMsg::Increment => {
self.counter = self.counter.wrapping_add(1);
}
AppInput::Decrement => {
AppMsg::Decrement => {
self.counter = self.counter.wrapping_sub(1);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/efficient_ui/tracker.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ 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
tracker = "0.1"
tracker = "0.2.2"
```

Now let's have a look at a small example.
Expand Down

0 comments on commit 253b3cf

Please sign in to comment.