From 3f81c524ccad2dd3fc4e6144f68b133132b1421b Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 16 Mar 2024 15:56:10 +0100 Subject: Reuse `Pokedex` search `Command` in `update` logic --- examples/pokedex/src/main.rs | 6 +++--- 1 file 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 { + fn search() -> Command { Command::perform(Pokemon::search(), Message::PokemonFound) } @@ -56,7 +56,7 @@ impl Pokedex { _ => { *self = Pokedex::Loading; - Command::perform(Pokemon::search(), Message::PokemonFound) + Self::search() } }, } -- cgit