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/application.rs | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'src/application.rs') diff --git a/src/application.rs b/src/application.rs index 5d16b40f..f5e06471 100644 --- a/src/application.rs +++ b/src/application.rs @@ -103,10 +103,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, @@ -166,14 +162,14 @@ impl Application

{ Self: 'static, P::State: Default, { - self.run_with(P::State::default) + self.raw.run(self.settings, Some(self.window)) } /// Runs the [`Application`] 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, Some(self.window), initialize) @@ -323,20 +319,6 @@ impl Application

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