summaryrefslogtreecommitdiffstats
path: root/examples/system_information
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-16 05:33:47 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-16 05:33:47 +0100
commitc22269bff3085012d326a0df77bf27ad5bcb41b7 (patch)
tree1083f21d012ab2bac88fb51537d4dc431bc7f170 /examples/system_information
parent0524e9b4571d264018656418f02a1f9e27e268d7 (diff)
downloadiced-c22269bff3085012d326a0df77bf27ad5bcb41b7.tar.gz
iced-c22269bff3085012d326a0df77bf27ad5bcb41b7.tar.bz2
iced-c22269bff3085012d326a0df77bf27ad5bcb41b7.zip
Introduce `Program` API
Diffstat (limited to 'examples/system_information')
-rw-r--r--examples/system_information/src/main.rs21
1 files changed, 6 insertions, 15 deletions
diff --git a/examples/system_information/src/main.rs b/examples/system_information/src/main.rs
index 31dc92f1..079c2c46 100644
--- a/examples/system_information/src/main.rs
+++ b/examples/system_information/src/main.rs
@@ -1,12 +1,12 @@
use iced::widget::{button, column, container, text};
-use iced::{
- executor, system, Application, Command, Element, Length, Settings, Theme,
-};
+use iced::{system, Command, Element, Length};
use bytesize::ByteSize;
pub fn main() -> iced::Result {
- Example::run(Settings::default())
+ iced::application(Example::new, Example::update, Example::view)
+ .title("System Information - Iced")
+ .run()
}
#[allow(clippy::large_enum_variant)]
@@ -22,23 +22,14 @@ enum Message {
Refresh,
}
-impl Application for Example {
- type Message = Message;
- type Theme = Theme;
- type Executor = executor::Default;
- type Flags = ();
-
- fn new(_flags: ()) -> (Self, Command<Message>) {
+impl Example {
+ fn new() -> (Self, Command<Message>) {
(
Self::Loading,
system::fetch_information(Message::InformationReceived),
)
}
- fn title(&self) -> String {
- String::from("System Information - Iced")
- }
-
fn update(&mut self, message: Message) -> Command<Message> {
match message {
Message::Refresh => {