summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatar Osma S. Rautila <44613540+xosxos@users.noreply.github.com>2024-12-01 15:31:27 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-12-03 01:28:03 +0100
commit334f5baa106f8e2c86448f9b10f869b7ef0a2fe0 (patch)
tree0fb0bcbcaa550bdfa1874fec18bafce6e1f50d64 /examples
parent3b2a422d5d4bf0d21301338050637ce717cff5f7 (diff)
downloadiced-334f5baa106f8e2c86448f9b10f869b7ef0a2fe0.tar.gz
iced-334f5baa106f8e2c86448f9b10f869b7ef0a2fe0.tar.bz2
iced-334f5baa106f8e2c86448f9b10f869b7ef0a2fe0.zip
fix: add run_with(Example::new)
The example was not running the `update` method and was stuck on the loading screen (at least on macos). This fixes is on my system.
Diffstat (limited to 'examples')
-rw-r--r--examples/system_information/src/main.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/system_information/src/main.rs b/examples/system_information/src/main.rs
index 363df590..46176d93 100644
--- a/examples/system_information/src/main.rs
+++ b/examples/system_information/src/main.rs
@@ -7,7 +7,7 @@ pub fn main() -> iced::Result {
Example::update,
Example::view,
)
- .run()
+ .run_with(Example::new)
}
#[derive(Default)]
@@ -28,6 +28,10 @@ enum Message {
}
impl Example {
+ fn new() -> (Self, Task<Message>) {
+ (Self::Loading, Task::done(Message::Refresh))
+ }
+
fn update(&mut self, message: Message) -> Task<Message> {
match message {
Message::Refresh => {