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 {
|
pub fn main() -> iced::Result {
|
||||||
iced::application(Pokedex::title, Pokedex::update, Pokedex::view)
|
iced::application(Pokedex::title, Pokedex::update, Pokedex::view)
|
||||||
.load(Pokedex::load)
|
.load(Pokedex::search)
|
||||||
.run()
|
.run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -25,7 +25,7 @@ enum Message {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Pokedex {
|
impl Pokedex {
|
||||||
fn load() -> Command<Message> {
|
fn search() -> Command<Message> {
|
||||||
Command::perform(Pokemon::search(), Message::PokemonFound)
|
Command::perform(Pokemon::search(), Message::PokemonFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,7 +56,7 @@ impl Pokedex {
|
||||||
_ => {
|
_ => {
|
||||||
*self = Pokedex::Loading;
|
*self = Pokedex::Loading;
|
||||||
|
|
||||||
Command::perform(Pokemon::search(), Message::PokemonFound)
|
Self::search()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue