pub fn set_fallback_runtime(
configure: impl FnOnce(&mut Builder),
) -> Result<(), SetFallbackRuntimeError>Expand description
Configures the runtime that Compat uses when it is polled outside a tokio context.
The runtime is built right away with the default’s scheduler (current-thread, or
multi-threaded with the multi-thread feature) and enable_all(), then configure
applies. Call it before anything falls back; it is process-wide, so only applications
should call it.
§Errors
Fails if a fallback runtime already exists, or if the runtime or the thread that drives a current-thread one cannot be created; the default runtime is used then.
§Examples
async_compat::set_fallback_runtime(|builder| {
builder.worker_threads(2).thread_name("my-app-tokio");
})
.unwrap();