Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

harmonize first examples #76

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading