fn execute<F>(future: F) -> Result<(), ExecuteError<F>>
where F: Future<Item = (), Error = ()> + 'static,
{
    CURRENT.with(|current| {
        match current.schedule.get() {
            Some(schedule) => {
                let spawned = Task::new(future);

                let num_futures = current.num_futures.get();
                current.num_futures.set(num_futures + 1);

                unsafe { (*schedule).schedule(spawned); }

                Ok(())
            }
            None => {
                Err(ExecuteError::new(ExecuteErrorKind::Shutdown, future))
            }
        }
    })
}
/// Submits a future to the current executor. This is done by
/// checking the thread-local variable tracking the current executor.
///
/// If this function is not called in context of an executor, i.e. outside of
/// `run`, then `Err` is returned.
///
/// This function does not panic.
Submits a future to the current executor. This is done by
checking the thread-local variable tracking the current executor.

If this function is not called in context of an executor, i.e. outside of
`run`, then `Err` is returned.

This function does not panic.
Submits a future to the current executor . This is done by checking the thread - local variable tracking the current executor . If this function is not called in context of an executor i . e . outside of ` run ` then ` Err ` is returned . This function does not panic .
fn execute<F>(future: F) -> Result<(), ExecuteError<F>>
where F: Future<Item = (), Error = ()> + 'static,
{
    CURRENT.with(|current| {
        match current.schedule.get() {
            Some(schedule) => {
                let spawned = Task::new(future);
                let num_futures = current.num_futures.get();
                current.num_futures.set(num_futures + 1);
                unsafe { (*schedule).schedule(spawned); }
                Ok(())
            }
            None => {
                Err(ExecuteError::new(ExecuteErrorKind::Shutdown, future))
            }
        }
    })
}
fn execute < F > ( future : F ) -> Result < ( ) , ExecuteError < F > > where F : Future < Item = ( ) , Error = ( ) > + ' static , { CURRENT . with ( | current | { match current . schedule . get ( ) { Some ( schedule ) => { let spawned = Task :: new ( future ) ; let num_futures = current . num_futures . get ( ) ; current . num_futures . set ( num_futures + 1 ) ; unsafe { ( * schedule ) . schedule ( spawned ) ; } Ok ( ( ) ) } None => { Err ( ExecuteError :: new ( ExecuteErrorKind :: Shutdown , future ) ) } } } ) }
Submits a future to the current executor.
Submits a future to the current executor .
future
F
future
F