summaryrefslogtreecommitdiffstats
path: root/examples/pokedex
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-16 15:56:10 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-16 15:56:10 +0100
commit3f81c524ccad2dd3fc4e6144f68b133132b1421b (patch)
tree3ec3200eda3aac3b48d0542187db45d4ed604586 /examples/pokedex
parent93ae790da14544667176ecdbdd6a4eaaa98a248a (diff)
downloadiced-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.rs6
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()
}
},
}