diff options
author | 2024-06-16 20:24:41 +0200 | |
---|---|---|
committer | 2024-06-16 20:24:41 +0200 | |
commit | 95d4adb55e485c01eec839736f328be26f2ccab6 (patch) | |
tree | 2676e3cb8ec17c5bf1cd561d97932ae302551dfd /examples/system_information/src | |
parent | e6d0b3bda5042a1017a5944a5227c97e0ed6caf9 (diff) | |
parent | b5c5a016c4f2b608a740b37c494186557a064f48 (diff) | |
download | iced-95d4adb55e485c01eec839736f328be26f2ccab6.tar.gz iced-95d4adb55e485c01eec839736f328be26f2ccab6.tar.bz2 iced-95d4adb55e485c01eec839736f328be26f2ccab6.zip |
Merge pull request #2463 from iced-rs/task-api
`Task` API
Diffstat (limited to 'examples/system_information/src')
-rw-r--r-- | examples/system_information/src/main.rs | 9 |
1 files changed, 5 insertions, 4 deletions
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<Message> { + fn update(&mut self, message: Message) -> Task<Message> { 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<Message> { |