From 5dab5a327ef643ee38ac3e42ab35212fff445631 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 28 Jan 2022 17:35:47 +0700 Subject: Introduce `MaybeSend` trait in `iced_futures` It allows to clean up all the `trait_aliases` modules! --- futures/src/executor.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'futures/src/executor.rs') diff --git a/futures/src/executor.rs b/futures/src/executor.rs index 23682f32..34e329a0 100644 --- a/futures/src/executor.rs +++ b/futures/src/executor.rs @@ -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 + Send + 'static); - - /// Spawns a local future in the [`Executor`]. - #[cfg(target_arch = "wasm32")] - fn spawn(&self, future: impl Future + 'static); + fn spawn(&self, future: impl Future + MaybeSend + 'static); /// Runs the given closure inside the [`Executor`]. /// -- cgit