Introduce MaybeSend trait in iced_futures
It allows to clean up all the `trait_aliases` modules!
This commit is contained in:
parent
83c649b574
commit
5dab5a327e
6 changed files with 49 additions and 150 deletions
|
|
@ -33,6 +33,7 @@ pub use self::smol::Smol;
|
|||
#[cfg(target_arch = "wasm32")]
|
||||
pub use wasm_bindgen::WasmBindgen;
|
||||
|
||||
use crate::MaybeSend;
|
||||
use futures::Future;
|
||||
|
||||
/// A type that can run futures.
|
||||
|
|
@ -43,12 +44,7 @@ pub trait Executor: Sized {
|
|||
Self: Sized;
|
||||
|
||||
/// Spawns a future in the [`Executor`].
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn spawn(&self, future: impl Future<Output = ()> + Send + 'static);
|
||||
|
||||
/// Spawns a local future in the [`Executor`].
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
fn spawn(&self, future: impl Future<Output = ()> + 'static);
|
||||
fn spawn(&self, future: impl Future<Output = ()> + MaybeSend + 'static);
|
||||
|
||||
/// Runs the given closure inside the [`Executor`].
|
||||
///
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue