Allow specifying a custom executor
This commit is contained in:
parent
f897442831
commit
f9ee3229c1
2 changed files with 92 additions and 0 deletions
|
|
@ -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`].
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue