summaryrefslogtreecommitdiffstats
path: root/src/daemon.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-07-09 00:28:40 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-07-09 00:28:40 +0200
commite86920be5b9984b4eb511e5e69efdcbf6ef3d8e4 (patch)
tree82180c9fa4c7381c5af747f42efda83214fda176 /src/daemon.rs
parent3d99da805dd42a062aa66a3bdc43c7cf82fa4fbe (diff)
downloadiced-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 'src/daemon.rs')
-rw-r--r--src/daemon.rs21
1 files changed, 2 insertions, 19 deletions
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<Self::Message> {
- Task::none()
- }
-
fn update(
&self,
state: &mut Self::State,
@@ -116,14 +112,14 @@ impl<P: Program> Daemon<P> {
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<I>(self, initialize: I) -> Result
where
Self: 'static,
- I: Fn() -> P::State + Clone + 'static,
+ I: Fn() -> (P::State, Task<P::Message>) + Clone + 'static,
{
self.raw.run_with(self.settings, None, initialize)
}
@@ -176,19 +172,6 @@ impl<P: Program> Daemon<P> {
}
}
- /// Runs the [`Task`] produced by the closure at startup.
- pub fn load(
- self,
- f: impl Fn() -> Task<P::Message>,
- ) -> Daemon<
- impl Program<State = P::State, Message = P::Message, Theme = P::Theme>,
- > {
- Daemon {
- raw: program::with_load(self.raw, f),
- settings: self.settings,
- }
- }
-
/// Sets the subscription logic of the [`Daemon`].
pub fn subscription(
self,