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 From d20ce8d82cb4936602c57064a896f7ed686529be Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 18 Sep 2024 21:19:18 +0200 Subject: Import `Executor` directly from `crate` --- src/application.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/application.rs') diff --git a/src/application.rs b/src/application.rs index d175cf85..2ba764be 100644 --- a/src/application.rs +++ b/src/application.rs @@ -30,11 +30,11 @@ //! ] //! } //! ``` -use iced_futures::Executor; - use crate::program::{self, Program}; use crate::window; -use crate::{Element, Font, Result, Settings, Size, Subscription, Task}; +use crate::{ + Element, Executor, Font, Result, Settings, Size, Subscription, Task, +}; use std::borrow::Cow; -- cgit