From f9ee3229c1e641b451f18d6f1b0a75a608a6b023 Mon Sep 17 00:00:00 2001 From: mtkennerly Date: Wed, 18 Sep 2024 01:27:35 -0400 Subject: Allow specifying a custom executor --- src/application.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/application.rs') 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 Application

{ window: self.window, } } + + /// Sets the executor of the [`Application`]. + pub fn executor( + self, + ) -> Application< + impl Program, + > + where + E: Executor, + { + Application { + raw: program::with_executor::(self.raw), + settings: self.settings, + window: self.window, + } + } } /// The title logic of some [`Application`]. -- cgit