diff options
author | 2024-07-09 00:28:40 +0200 | |
---|---|---|
committer | 2024-07-09 00:28:40 +0200 | |
commit | e86920be5b9984b4eb511e5e69efdcbf6ef3d8e4 (patch) | |
tree | 82180c9fa4c7381c5af747f42efda83214fda176 /examples/pokedex/src/main.rs | |
parent | 3d99da805dd42a062aa66a3bdc43c7cf82fa4fbe (diff) | |
download | iced-e86920be5b9984b4eb511e5e69efdcbf6ef3d8e4.tar.gz iced-e86920be5b9984b4eb511e5e69efdcbf6ef3d8e4.tar.bz2 iced-e86920be5b9984b4eb511e5e69efdcbf6ef3d8e4.zip |
Remove `load` method from `application` and `daemon`
If you need to run a `Task` during boot, use
`run_with` instead!
Diffstat (limited to '')
-rw-r--r-- | examples/pokedex/src/main.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/pokedex/src/main.rs b/examples/pokedex/src/main.rs index b22ffe7f..7414ae54 100644 --- a/examples/pokedex/src/main.rs +++ b/examples/pokedex/src/main.rs @@ -4,17 +4,13 @@ use iced::{Alignment, Element, Length, Task}; pub fn main() -> iced::Result { iced::application(Pokedex::title, Pokedex::update, Pokedex::view) - .load(Pokedex::search) - .run() + .run_with(Pokedex::new) } -#[derive(Debug, Default)] +#[derive(Debug)] enum Pokedex { - #[default] Loading, - Loaded { - pokemon: Pokemon, - }, + Loaded { pokemon: Pokemon }, Errored, } @@ -25,6 +21,10 @@ enum Message { } impl Pokedex { + fn new() -> (Self, Task<Message>) { + (Self::Loading, Self::search()) + } + fn search() -> Task<Message> { Task::perform(Pokemon::search(), Message::PokemonFound) } |