From a25b1af45690bdd8e1cbb20ee3a5b1c4342de455 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 14 Jun 2024 01:47:39 +0200 Subject: Replace `Command` with a new `Task` API with chain support --- examples/system_information/src/main.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'examples/system_information/src/main.rs') diff --git a/examples/system_information/src/main.rs b/examples/system_information/src/main.rs index 8ce12e1c..e2808edd 100644 --- a/examples/system_information/src/main.rs +++ b/examples/system_information/src/main.rs @@ -1,5 +1,5 @@ use iced::widget::{button, center, column, text}; -use iced::{system, Command, Element}; +use iced::{system, Element, Task}; pub fn main() -> iced::Result { iced::program("System Information - Iced", Example::update, Example::view) @@ -24,19 +24,20 @@ enum Message { } impl Example { - fn update(&mut self, message: Message) -> Command { + fn update(&mut self, message: Message) -> Task { match message { Message::Refresh => { *self = Self::Loading; - return system::fetch_information(Message::InformationReceived); + return system::fetch_information() + .map(Message::InformationReceived); } Message::InformationReceived(information) => { *self = Self::Loaded { information }; } } - Command::none() + Task::none() } fn view(&self) -> Element { -- cgit