pub fn spawn_sendable<F>(
fut: F,
) -> impl Future<Output = Result<F::Output, JoinError>> + Send + 'staticExpand description
Spawns a local future and returns a Send future for its result.
The task is spawned immediately on the current runtime, using
crate::spawn_detached and its registered task callbacks. The spawned
future need not be Send, but its output must be. Only the returned future
may be moved to another thread; the task stays on its original runtime,
which must keep being driven.
Dropping the returned future requests cancellation, even before its first poll. The task’s future is dropped on its runtime thread when the runtime next processes the task, or during shutdown. Cancellation does not wait for cleanup or interrupt an active poll.
Awaiting the returned future yields the output or crate::JoinError if
the task ends without one, for example on panic or runtime shutdown. Task
panics follow the runtime’s usual behavior.
§Panics
Panics outside a runtime context that supports crate::spawn_detached.