diff options
author | 2024-07-09 00:28:40 +0200 | |
---|---|---|
committer | 2024-07-09 00:28:40 +0200 | |
commit | e86920be5b9984b4eb511e5e69efdcbf6ef3d8e4 (patch) | |
tree | 82180c9fa4c7381c5af747f42efda83214fda176 /examples/multi_window | |
parent | 3d99da805dd42a062aa66a3bdc43c7cf82fa4fbe (diff) | |
download | iced-e86920be5b9984b4eb511e5e69efdcbf6ef3d8e4.tar.gz iced-e86920be5b9984b4eb511e5e69efdcbf6ef3d8e4.tar.bz2 iced-e86920be5b9984b4eb511e5e69efdcbf6ef3d8e4.zip |
Remove `load` method from `application` and `daemon`
If you need to run a `Task` during boot, use
`run_with` instead!
Diffstat (limited to 'examples/multi_window')
-rw-r--r-- | examples/multi_window/src/main.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/examples/multi_window/src/main.rs b/examples/multi_window/src/main.rs index 98e753ab..460ca3b5 100644 --- a/examples/multi_window/src/main.rs +++ b/examples/multi_window/src/main.rs @@ -9,16 +9,12 @@ use std::collections::BTreeMap; fn main() -> iced::Result { iced::daemon(Example::title, Example::update, Example::view) - .load(|| { - window::open(window::Settings::default()).map(Message::WindowOpened) - }) .subscription(Example::subscription) .theme(Example::theme) .scale_factor(Example::scale_factor) - .run() + .run_with(Example::new) } -#[derive(Default)] struct Example { windows: BTreeMap<window::Id, Window>, } @@ -43,6 +39,16 @@ enum Message { } impl Example { + fn new() -> (Self, Task<Message>) { + ( + Self { + windows: BTreeMap::new(), + }, + window::open(window::Settings::default()) + .map(Message::WindowOpened), + ) + } + fn title(&self, window: window::Id) -> String { self.windows .get(&window) |