Reuse Pokedex search Command in update logic
This commit is contained in:
parent
93ae790da1
commit
3f81c524cc
1 changed files with 3 additions and 3 deletions
|
|
@ -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()
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue