diff options
author | 2022-04-27 16:18:27 -0300 | |
---|---|---|
committer | 2022-04-27 17:16:32 -0300 | |
commit | 5eefa5d4ead9ebfac7dab1db9aebf9797d2dad38 (patch) | |
tree | 335b97909321ee88c648aba5406c33083e35eea5 /examples/system_information/src/main.rs | |
parent | 6e167675d6a51a8a78d93439719ebffe35dcfdef (diff) | |
download | iced-5eefa5d4ead9ebfac7dab1db9aebf9797d2dad38.tar.gz iced-5eefa5d4ead9ebfac7dab1db9aebf9797d2dad38.tar.bz2 iced-5eefa5d4ead9ebfac7dab1db9aebf9797d2dad38.zip |
Simplify the `QueryInformation` Action
Diffstat (limited to 'examples/system_information/src/main.rs')
-rw-r--r-- | examples/system_information/src/main.rs | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/examples/system_information/src/main.rs b/examples/system_information/src/main.rs index 1e61480f..704f5f4d 100644 --- a/examples/system_information/src/main.rs +++ b/examples/system_information/src/main.rs @@ -15,12 +15,11 @@ enum Example { information: system::Information, refresh_button: button::State, }, - Unsupported, } #[derive(Clone, Debug)] enum Message { - InformationReceived(Option<system::Information>), + InformationReceived(system::Information), Refresh, } @@ -46,15 +45,11 @@ impl Application for Example { return system::fetch_information(Message::InformationReceived); } Message::InformationReceived(information) => { - if let Some(information) = information { - let refresh_button = button::State::new(); - *self = Self::Loaded { - information, - refresh_button, - }; - } else { - *self = Self::Unsupported; - } + let refresh_button = button::State::new(); + *self = Self::Loaded { + information, + refresh_button, + }; } } @@ -156,7 +151,6 @@ impl Application for Example { .spacing(10) .into() } - Example::Unsupported => Text::new("Unsupported!").size(20).into(), }; Container::new(content) |