pub fn try_spawn<F, T>(
future: F,
) -> Result<JoinHandle<T>, (RuntimeConfigError, F)>Expand description
Submit a future without consuming it when the runtime is not accepting work.
Lifecycle owners can retain the returned future and retry it after
start completes a runtime restart.
On a wasm target, prefer this over spawn. Building the MultiThread
pool is lazy and fail-loud: the first async call is what calls
wasi.thread-spawn, and whether that works is a JavaScript fact the crate
cannot observe up front. Here the failure is an Err you can act on; the
infallible helpers turn it into a panic, which panic = "abort" then turns
into a dead instance.