Remove load method from application and daemon
If you need to run a `Task` during boot, use `run_with` instead!
This commit is contained in:
parent
3d99da805d
commit
e86920be5b
10 changed files with 70 additions and 197 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue