pub fn spawn<T>(obj: T) -> Spawn<T>
Expand description
Spawns a future or stream, returning it and the new task responsible for running it to completion.
This function is the termination endpoint for running futures. This method
will conceptually allocate a new task to run the given object, which is
normally either a Future
or Stream
.
This function is similar to the thread::spawn
function but does not
attempt to run code in the background. The future will not make progress
until the methods on Spawn
are called in turn.