/// Allows spawning non-`static futures on the thread pool. The function takes a callback,
/// passing a scope object into it. The scope object provided to the callback can be used
/// to spawn tasks. This function will await the completion of all tasks before returning.
///
/// This is similar to `rayon::scope` and `crossbeam::scope`
Allows spawning non-`static futures on the thread pool. The function takes a callback,
passing a scope object into it. The scope object provided to the callback can be used
to spawn tasks. This function will await the completion of all tasks before returning.

This is similar to `rayon::scope` and `crossbeam::scope`
Allows spawning non - ` static futures on the thread pool . The function takes a callback passing a scope object into it . The scope object provided to the callback can be used to spawn tasks . This function will await the completion of all tasks before returning . This is similar to ` rayon :: scope ` and ` crossbeam :: scope `
pub fn scope<'scope, F, T>(&self, f: F) -> Vec<T>
    where
        F: FnOnce(&mut Scope<'scope, T>) + 'scope + Send,
        T: Send + 'static,
    {
        let executor = async_executor::LocalExecutor::new();
        let executor: &async_executor::LocalExecutor = &executor;
        let executor: &'scope async_executor::LocalExecutor = unsafe { mem::transmute(executor) };
        let mut scope = Scope {
            executor,
            results: Vec::new(),
        };
        f(&mut scope);
        // Loop until all tasks are done
        while executor.try_tick() {}
        scope
            .results
            .iter()
            .map(|result| result.lock().unwrap().take().unwrap())
            .collect()
    }
pub fn scope < ' scope , F , T > ( & self , f : F ) -> Vec < T > where F : FnOnce ( & mut Scope < ' scope , T > ) + ' scope + Send , T : Send + ' static , { let executor = async_executor :: LocalExecutor :: new ( ) ; let executor : & async_executor :: LocalExecutor = & executor ; let executor : & ' scope async_executor :: LocalExecutor = unsafe { mem :: transmute ( executor ) } ; let mut scope = Scope { executor , results : Vec :: new ( ) , } ; f ( & mut scope ) ; // Loop until all tasks are done while executor . try_tick ( ) { } scope . results . iter ( ) . map ( | result | result . lock ( ) . unwrap ( ) . take ( ) . unwrap ( ) ) . collect ( ) }
Allows spawning non-`static futures on the thread pool.
Allows spawning non - ` static futures on the thread pool .
&self
f
F