pub fn start<F>(mut self, future: F) where F: Future<Output = ()> + 'static {
        let cb = self.finish_callback.take();
        let finish_cb = || {
            if let Some(cb) = cb {
                cb();
            }
        };

        match (self.inner_runtime, self.local_inner_runtime) {
            #[cfg(feature = "tokio_executor")]
            (TokioRuntime(runtime), LocalExecutorInnerRuntime::TokioRuntime(localset)) => {
                runtime.block_on(async move {
                    localset.run_until(future).await;
                });
                finish_cb();
            },
            #[cfg(feature = "async_std_executor")]
            (AsyncStdRuntime, _) => {
                async_std::task::block_on(future);
                finish_cb();
            },
            #[cfg(feature = "smol_executor")]
            (SmolRuntime(executor, num_threads),  LocalExecutorInnerRuntime::SmolRuntime(local)) => {
                if num_threads > 1 {
                    let (signal, shutdown) = async_channel::unbounded::<()>();
                    easy_parallel::Parallel::new()
                        .each(0..num_threads, |_| futures_lite::future::block_on(executor.run(shutdown.recv())))
                        .finish(|| {
                            futures_lite::future::block_on(async {
                                local.run(future).await;
                                drop(signal);
                            });
                            finish_cb();
                        });
                } else {
                    futures_lite::future::block_on(local.run(future));
                    finish_cb();
                }
            },
            #[cfg(feature = "futures_executor")]
            (FuturesRuntime(_), LocalExecutorInnerRuntime::FuturesRuntime(mut local)) => {
                local.run_until(future);
                finish_cb();
            },
            #[cfg(feature = "wasm_bindgen_executor")]
            (WasmBindgenRuntime, _) => {
                wasm_bindgen_futures::spawn_local(async move {
                    future.await;
                    finish_cb();
                });
            },
            _ => { panic!("Couldn't start the executor."); }
        }
    }
/// Start the executor with the provided future. 
/// This future doesn't need to be Send, but it needs to be 'static. You can use async move {...} to achieve this if needed.
/// Note that in wasm the call might finish before the future has completely executed due to the non-blocking nature of the environment, so don't depend on this.
/// With the other executors you can depend on the fact that start is blocking, but the on_finish callback is called anyway.
Start the executor with the provided future.
This future doesn't need to be Send, but it needs to be 'static. You can use async move {...} to achieve this if needed.
Note that in wasm the call might finish before the future has completely executed due to the non-blocking nature of the environment, so don't depend on this.
With the other executors you can depend on the fact that start is blocking, but the on_finish callback is called anyway.
Start the executor with the provided future . This future doesn ' t need to be Send but it needs to be ' static . You can use async move { ... } to achieve this if needed . Note that in wasm the call might finish before the future has completely executed due to the non - blocking nature of the environment so don ' t depend on this . With the other executors you can depend on the fact that start is blocking but the on_finish callback is called anyway .
pub fn start<F>(mut self, future: F) where F: Future<Output = ()> + 'static {
        let cb = self.finish_callback.take();
        let finish_cb = || {
            if let Some(cb) = cb {
                cb();
            }
        };
        match (self.inner_runtime, self.local_inner_runtime) {
            #[cfg(feature = "tokio_executor")]
            (TokioRuntime(runtime), LocalExecutorInnerRuntime::TokioRuntime(localset)) => {
                runtime.block_on(async move {
                    localset.run_until(future).await;
                });
                finish_cb();
            },
            #[cfg(feature = "async_std_executor")]
            (AsyncStdRuntime, _) => {
                async_std::task::block_on(future);
                finish_cb();
            },
            #[cfg(feature = "smol_executor")]
            (SmolRuntime(executor, num_threads),  LocalExecutorInnerRuntime::SmolRuntime(local)) => {
                if num_threads > 1 {
                    let (signal, shutdown) = async_channel::unbounded::<()>();
                    easy_parallel::Parallel::new()
                        .each(0..num_threads, |_| futures_lite::future::block_on(executor.run(shutdown.recv())))
                        .finish(|| {
                            futures_lite::future::block_on(async {
                                local.run(future).await;
                                drop(signal);
                            });
                            finish_cb();
                        });
                } else {
                    futures_lite::future::block_on(local.run(future));
                    finish_cb();
                }
            },
            #[cfg(feature = "futures_executor")]
            (FuturesRuntime(_), LocalExecutorInnerRuntime::FuturesRuntime(mut local)) => {
                local.run_until(future);
                finish_cb();
            },
            #[cfg(feature = "wasm_bindgen_executor")]
            (WasmBindgenRuntime, _) => {
                wasm_bindgen_futures::spawn_local(async move {
                    future.await;
                    finish_cb();
                });
            },
            _ => { panic!("Couldn't start the executor."); }
        }
    }
pub fn start < F > ( mut self , future : F ) where F : Future < Output = ( ) > + ' static { let cb = self . finish_callback . take ( ) ; let finish_cb = | | { if let Some ( cb ) = cb { cb ( ) ; } } ; match ( self . inner_runtime , self . local_inner_runtime ) { # [ cfg ( feature " " ) ] ( TokioRuntime ( runtime ) , LocalExecutorInnerRuntime :: TokioRuntime ( localset ) ) => { runtime . block_on ( async move { localset . run_until ( future ) . await ; } ) ; finish_cb ( ) ; } , # [ cfg ( feature " " ) ] ( AsyncStdRuntime , _ ) => { async_std :: task :: block_on ( future ) ; finish_cb ( ) ; } , # [ cfg ( feature " " ) ] ( SmolRuntime ( executor , num_threads ) , LocalExecutorInnerRuntime :: SmolRuntime ( local ) ) => { if num_threads > 1 { let ( signal , shutdown ) = async_channel :: unbounded :: < ( ) > ( ) ; easy_parallel :: Parallel :: new ( ) . each ( 0 .. num_threads , | _ | futures_lite :: future :: block_on ( executor . run ( shutdown . recv ( ) ) ) ) . finish ( | | { futures_lite :: future :: block_on ( async { local . run ( future ) . await ; drop ( signal ) ; } ) ; finish_cb ( ) ; } ) ; } else { futures_lite :: future :: block_on ( local . run ( future ) ) ; finish_cb ( ) ; } } , # [ cfg ( feature " " ) ] ( FuturesRuntime ( _ ) , LocalExecutorInnerRuntime :: FuturesRuntime ( mut local ) ) => { local . run_until ( future ) ; finish_cb ( ) ; } , # [ cfg ( feature " " ) ] ( WasmBindgenRuntime , _ ) => { wasm_bindgen_futures :: spawn_local ( async move { future . await ; finish_cb ( ) ; } ) ; } , _ => { panic ! ( " " ) ; } } }
Start the executor with the provided future.
Start the executor with the provided future .
mut self
future
F