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! --- src/daemon.rs | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'src/daemon.rs') diff --git a/src/daemon.rs b/src/daemon.rs index 58293949..d2de2db7 100644 --- a/src/daemon.rs +++ b/src/daemon.rs @@ -55,10 +55,6 @@ where type Renderer = Renderer; type Executor = iced_futures::backend::default::Executor; - fn load(&self) -> Task { - Task::none() - } - fn update( &self, state: &mut Self::State, @@ -116,14 +112,14 @@ impl Daemon

{ Self: 'static, P::State: Default, { - self.run_with(P::State::default) + self.raw.run(self.settings, None) } /// Runs the [`Daemon`] with a closure that creates the initial state. pub fn run_with(self, initialize: I) -> Result where Self: 'static, - I: Fn() -> P::State + Clone + 'static, + I: Fn() -> (P::State, Task) + Clone + 'static, { self.raw.run_with(self.settings, None, initialize) } @@ -176,19 +172,6 @@ impl Daemon

{ } } - /// Runs the [`Task`] produced by the closure at startup. - pub fn load( - self, - f: impl Fn() -> Task, - ) -> Daemon< - impl Program, - > { - Daemon { - raw: program::with_load(self.raw, f), - settings: self.settings, - } - } - /// Sets the subscription logic of the [`Daemon`]. pub fn subscription( self, -- cgit