From 5eefa5d4ead9ebfac7dab1db9aebf9797d2dad38 Mon Sep 17 00:00:00 2001 From: Richard Date: Wed, 27 Apr 2022 16:18:27 -0300 Subject: Simplify the `QueryInformation` Action --- examples/system_information/Cargo.toml | 2 +- examples/system_information/src/main.rs | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) (limited to 'examples') 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), + 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) -- cgit