pub fn spawn<F, T>(&self, future: F) -> JoinHandle<T>
    where
        F: Future<Output = T> + Send + 'static,
        T: Send + 'static,
    {
        let inner = match &self.inner {
            #[cfg(feature = "tokio_executor")]
            TokioHandle(handle) => {
                JoinHandleInner::<T>::Tokio(Some(handle.spawn(future)))
            },
            #[cfg(feature = "async_std_executor")]
            AsyncStdHandle => {
                JoinHandleInner::<T>::AsyncStd(Some(async_std::task::spawn(future)))
            }, 
            #[cfg(feature = "smol_executor")]
            SmolHandle(executor) => {
                JoinHandleInner::<T>::Smol(Some(executor.spawn(future)))
            },
            #[cfg(feature = "futures_executor")]
            FuturesHandle(executor) => {
                // TODO See if we can use spawn_with_handle, but maybe not a good idea if we need to introduce extra dependencies/features: https://docs.rs/futures/0.3.18/futures/task/trait.SpawnExt.html
                use futures::future::FutureExt;
                let (future, handle) = future.remote_handle();
                executor.spawn_ok(future);
                JoinHandleInner::<T>::RemoteHandle(Some(handle))
            },
            #[cfg(feature = "wasm_bindgen_executor")]
            WasmBindgenHandle => {
                use futures::future::FutureExt;
                let (future, handle) = future.remote_handle();
                wasm_bindgen_futures::spawn_local(future);
                JoinHandleInner::<T>::RemoteHandle(Some(handle))
            }
        };

        JoinHandle{inner}
    }
/// Spawns a future on this executor.
Spawns a future on this executor.
Spawns a future on this executor .
pub fn spawn<F, T>(&self, future: F) -> JoinHandle<T>
    where
        F: Future<Output = T> + Send + 'static,
        T: Send + 'static,
    {
        let inner = match &self.inner {
            #[cfg(feature = "tokio_executor")]
            TokioHandle(handle) => {
                JoinHandleInner::<T>::Tokio(Some(handle.spawn(future)))
            },
            #[cfg(feature = "async_std_executor")]
            AsyncStdHandle => {
                JoinHandleInner::<T>::AsyncStd(Some(async_std::task::spawn(future)))
            }, 
            #[cfg(feature = "smol_executor")]
            SmolHandle(executor) => {
                JoinHandleInner::<T>::Smol(Some(executor.spawn(future)))
            },
            #[cfg(feature = "futures_executor")]
            FuturesHandle(executor) => {
                // TODO See if we can use spawn_with_handle, but maybe not a good idea if we need to introduce extra dependencies/features: https://docs.rs/futures/0.3.18/futures/task/trait.SpawnExt.html
                use futures::future::FutureExt;
                let (future, handle) = future.remote_handle();
                executor.spawn_ok(future);
                JoinHandleInner::<T>::RemoteHandle(Some(handle))
            },
            #[cfg(feature = "wasm_bindgen_executor")]
            WasmBindgenHandle => {
                use futures::future::FutureExt;
                let (future, handle) = future.remote_handle();
                wasm_bindgen_futures::spawn_local(future);
                JoinHandleInner::<T>::RemoteHandle(Some(handle))
            }
        };
        JoinHandle{inner}
    }
pub fn spawn < F , T > ( & self , future : F ) -> JoinHandle < T > where F : Future < Output = T > + Send + ' static , T : Send + ' static , { let inner = match & self . inner { # [ cfg ( feature " " ) ] TokioHandle ( handle ) => { JoinHandleInner :: < T > :: Tokio ( Some ( handle . spawn ( future ) ) ) } , # [ cfg ( feature " " ) ] AsyncStdHandle => { JoinHandleInner :: < T > :: AsyncStd ( Some ( async_std :: task :: spawn ( future ) ) ) } , # [ cfg ( feature " " ) ] SmolHandle ( executor ) => { JoinHandleInner :: < T > :: Smol ( Some ( executor . spawn ( future ) ) ) } , # [ cfg ( feature " " ) ] FuturesHandle ( executor ) => { // TODO See if we can use spawn_with_handle, but maybe not a good idea if we need to introduce extra dependencies/features: https://docs.rs/futures/0.3.18/futures/task/trait.SpawnExt.html use futures :: future :: FutureExt ; let ( future , handle ) = future . remote_handle ( ) ; executor . spawn_ok ( future ) ; JoinHandleInner :: < T > :: RemoteHandle ( Some ( handle ) ) } , # [ cfg ( feature " " ) ] WasmBindgenHandle => { use futures :: future :: FutureExt ; let ( future , handle ) = future . remote_handle ( ) ; wasm_bindgen_futures :: spawn_local ( future ) ; JoinHandleInner :: < T > :: RemoteHandle ( Some ( handle ) ) } } ; JoinHandle { inner } }
Spawns a future on this executor.
Spawns a future on this executor .
&self
future
F