pub fn spawn<T: Future + 'static>(task: T) -> JoinHandle<T::Output>
Expand description
Spawns a new asynchronous task with the defualt Runtime
, returning a JoinHandle
for it.
Spawning a task enables the task to execute concurrently to other tasks. There is no guarantee that a spawned task will execute to completion. When a runtime is shutdown, all outstanding tasks are dropped, regardless of the lifecycle of that task.
This will create a new Runtime to run spawn.