Improve Overview section in README
This commit is contained in:
parent
8758dd446f
commit
51050fc45c
2 changed files with 11 additions and 9 deletions
|
|
@ -67,8 +67,8 @@ struct Counter {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Now that we have state... When will it change? When either button is pressed!
|
Next, we need to define the possible user interactions of our counter:
|
||||||
These user interactions are our __messages__:
|
the button presses. These interactions are our __messages__:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
|
@ -78,7 +78,8 @@ pub enum Message {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Next, let's put it all together in our __view logic__:
|
Now, let's show the actual counter by putting it all together in our
|
||||||
|
__view logic__:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
use iced::{Button, Column, Text};
|
use iced::{Button, Column, Text};
|
||||||
|
|
@ -108,7 +109,7 @@ impl Counter {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, we need to be able to react to the __messages__ and change our
|
Finally, we need to be able to react to any produced __messages__ and change our
|
||||||
__state__ accordingly in our __update logic__:
|
__state__ accordingly in our __update logic__:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|
|
||||||
11
src/lib.rs
11
src/lib.rs
|
|
@ -43,8 +43,8 @@
|
||||||
//! }
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! Now that we have state... When will it change? When either button is pressed!
|
//! Next, we need to define the possible user interactions of our counter:
|
||||||
//! These user interactions are our __messages__:
|
//! the button presses. These interactions are our __messages__:
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! ```
|
||||||
//! #[derive(Debug, Clone, Copy)]
|
//! #[derive(Debug, Clone, Copy)]
|
||||||
|
|
@ -54,7 +54,8 @@
|
||||||
//! }
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! Next, let's put it all together in our __view logic__:
|
//! Now, let's show the actual counter by putting it all together in our
|
||||||
|
//! __view logic__:
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! ```
|
||||||
//! # use iced::button;
|
//! # use iced::button;
|
||||||
|
|
@ -139,8 +140,8 @@
|
||||||
//! }
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! Finally, we need to be able to react to the __messages__ and change our
|
//! Finally, we need to be able to react to any produced __messages__ and change
|
||||||
//! __state__ accordingly in our __update logic__:
|
//! our __state__ accordingly in our __update logic__:
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! ```
|
||||||
//! # use iced::button;
|
//! # use iced::button;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue