pub fn spawn<F, S>(future: F, scheduler: S) -> (Runnable, AsyncTask<F::Output>)
Available on crate feature
async-task
only.Expand description
Spawn a future with a custom scheduler using async_task
.
This function creates a task that will be scheduled using the provided scheduler function.
The scheduler receives a Runnable
that should be executed to make progress on the task.
Returns a tuple of (runnable, task) where:
runnable
should be scheduled immediately to start the tasktask
is anAsyncTask
that can be awaited for the result