From e86920be5b9984b4eb511e5e69efdcbf6ef3d8e4 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 9 Jul 2024 00:28:40 +0200 Subject: Remove `load` method from `application` and `daemon` If you need to run a `Task` during boot, use `run_with` instead! --- examples/todos/src/main.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'examples/todos/src') diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs index 6ed50d31..b34f71ce 100644 --- a/examples/todos/src/main.rs +++ b/examples/todos/src/main.rs @@ -18,16 +18,14 @@ pub fn main() -> iced::Result { tracing_subscriber::fmt::init(); iced::application(Todos::title, Todos::update, Todos::view) - .load(Todos::load) .subscription(Todos::subscription) .font(include_bytes!("../fonts/icons.ttf").as_slice()) .window_size((500.0, 800.0)) - .run() + .run_with(Todos::new) } -#[derive(Default, Debug)] +#[derive(Debug)] enum Todos { - #[default] Loading, Loaded(State), } @@ -54,8 +52,11 @@ enum Message { } impl Todos { - fn load() -> Command { - Command::perform(SavedState::load(), Message::Loaded) + fn new() -> (Self, Command) { + ( + Self::Loading, + Command::perform(SavedState::load(), Message::Loaded), + ) } fn title(&self) -> String { -- cgit