summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-07-15 13:34:22 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-07-15 13:34:22 +0200
commitbdf0430880f5c29443f5f0a0ae4895866dfef4c6 (patch)
tree46a176e7b4e6828fdd1158932e05d547028edc61
parent950bfc07d4b71016bf3e9d53709395e185420cec (diff)
downloadiced-bdf0430880f5c29443f5f0a0ae4895866dfef4c6.tar.gz
iced-bdf0430880f5c29443f5f0a0ae4895866dfef4c6.tar.bz2
iced-bdf0430880f5c29443f5f0a0ae4895866dfef4c6.zip
Make `run_with` take a `FnOnce`
-rw-r--r--src/application.rs2
-rw-r--r--src/daemon.rs2
-rw-r--r--src/program.rs6
3 files changed, 5 insertions, 5 deletions
diff --git a/src/application.rs b/src/application.rs
index c21f343a..d0f77304 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -169,7 +169,7 @@ impl<P: Program> Application<P> {
pub fn run_with<I>(self, initialize: I) -> Result
where
Self: 'static,
- I: Fn() -> (P::State, Task<P::Message>) + Clone + 'static,
+ I: FnOnce() -> (P::State, Task<P::Message>) + 'static,
{
self.raw
.run_with(self.settings, Some(self.window), initialize)
diff --git a/src/daemon.rs b/src/daemon.rs
index d2de2db7..6a6ad133 100644
--- a/src/daemon.rs
+++ b/src/daemon.rs
@@ -119,7 +119,7 @@ impl<P: Program> Daemon<P> {
pub fn run_with<I>(self, initialize: I) -> Result
where
Self: 'static,
- I: Fn() -> (P::State, Task<P::Message>) + Clone + 'static,
+ I: FnOnce() -> (P::State, Task<P::Message>) + 'static,
{
self.raw.run_with(self.settings, None, initialize)
}
diff --git a/src/program.rs b/src/program.rs
index 939b0047..2b697fbe 100644
--- a/src/program.rs
+++ b/src/program.rs
@@ -92,7 +92,7 @@ pub trait Program: Sized {
) -> Result
where
Self: 'static,
- I: Fn() -> (Self::State, Task<Self::Message>) + Clone + 'static,
+ I: FnOnce() -> (Self::State, Task<Self::Message>) + 'static,
{
use std::marker::PhantomData;
@@ -102,8 +102,8 @@ pub trait Program: Sized {
_initialize: PhantomData<I>,
}
- impl<P: Program, I: Fn() -> (P::State, Task<P::Message>)> shell::Program
- for Instance<P, I>
+ impl<P: Program, I: FnOnce() -> (P::State, Task<P::Message>)>
+ shell::Program for Instance<P, I>
{
type Message = P::Message;
type Theme = P::Theme;