diff options
| author | 2024-03-16 15:56:10 +0100 | |
|---|---|---|
| committer | 2024-03-16 15:56:10 +0100 | |
| commit | 3f81c524ccad2dd3fc4e6144f68b133132b1421b (patch) | |
| tree | 3ec3200eda3aac3b48d0542187db45d4ed604586 /examples/pokedex | |
| parent | 93ae790da14544667176ecdbdd6a4eaaa98a248a (diff) | |
| download | iced-3f81c524ccad2dd3fc4e6144f68b133132b1421b.tar.gz iced-3f81c524ccad2dd3fc4e6144f68b133132b1421b.tar.bz2 iced-3f81c524ccad2dd3fc4e6144f68b133132b1421b.zip | |
Reuse `Pokedex` search `Command` in `update` logic
Diffstat (limited to 'examples/pokedex')
| -rw-r--r-- | examples/pokedex/src/main.rs | 6 | 
1 files changed, 3 insertions, 3 deletions
| diff --git a/examples/pokedex/src/main.rs b/examples/pokedex/src/main.rs index 882a195d..c737b87e 100644 --- a/examples/pokedex/src/main.rs +++ b/examples/pokedex/src/main.rs @@ -4,7 +4,7 @@ use iced::{Alignment, Command, Element, Length};  pub fn main() -> iced::Result {      iced::application(Pokedex::title, Pokedex::update, Pokedex::view) -        .load(Pokedex::load) +        .load(Pokedex::search)          .run()  } @@ -25,7 +25,7 @@ enum Message {  }  impl Pokedex { -    fn load() -> Command<Message> { +    fn search() -> Command<Message> {          Command::perform(Pokemon::search(), Message::PokemonFound)      } @@ -56,7 +56,7 @@ impl Pokedex {                  _ => {                      *self = Pokedex::Loading; -                    Command::perform(Pokemon::search(), Message::PokemonFound) +                    Self::search()                  }              },          } | 
