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 | |
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')
-rw-r--r-- | examples/system_information/Cargo.toml | 2 | ||||
-rw-r--r-- | examples/system_information/src/main.rs | 18 |
2 files changed, 7 insertions, 13 deletions
diff --git a/examples/system_information/Cargo.toml b/examples/system_information/Cargo.toml index d3d76182..13a59d5e 100644 --- a/examples/system_information/Cargo.toml +++ b/examples/system_information/Cargo.toml @@ -6,5 +6,5 @@ edition = "2021" publish = false [dependencies] -iced = { path = "../..", features = ["sysinfo"] } +iced = { path = "../.." } bytesize = { version = "1.1.0" }
\ No newline at end of file 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) |