summaryrefslogtreecommitdiffstats
path: root/src/application.rs
diff options
context:
space:
mode:
authorLibravatar mtkennerly <mtkennerly@gmail.com>2024-09-18 01:27:35 -0400
committerLibravatar mtkennerly <mtkennerly@gmail.com>2024-09-18 01:27:35 -0400
commitf9ee3229c1e641b451f18d6f1b0a75a608a6b023 (patch)
tree3547124f4effcabe450e609a7a9cc21aab1a3503 /src/application.rs
parentf89744283167a1961fcff512ad48b0eb9b8fcaef (diff)
downloadiced-f9ee3229c1e641b451f18d6f1b0a75a608a6b023.tar.gz
iced-f9ee3229c1e641b451f18d6f1b0a75a608a6b023.tar.bz2
iced-f9ee3229c1e641b451f18d6f1b0a75a608a6b023.zip
Allow specifying a custom executor
Diffstat (limited to '')
-rw-r--r--src/application.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/application.rs b/src/application.rs
index d0f77304..d175cf85 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -30,6 +30,8 @@
//! ]
//! }
//! ```
+use iced_futures::Executor;
+
use crate::program::{self, Program};
use crate::window;
use crate::{Element, Font, Result, Settings, Size, Subscription, Task};
@@ -376,6 +378,22 @@ impl<P: Program> Application<P> {
window: self.window,
}
}
+
+ /// Sets the executor of the [`Application`].
+ pub fn executor<E>(
+ self,
+ ) -> Application<
+ impl Program<State = P::State, Message = P::Message, Theme = P::Theme>,
+ >
+ where
+ E: Executor,
+ {
+ Application {
+ raw: program::with_executor::<P, E>(self.raw),
+ settings: self.settings,
+ window: self.window,
+ }
+ }
}
/// The title logic of some [`Application`].