pub fn with_ambient_tokio_runtime<R>(f: impl FnOnce() -> R) -> R
Expand description
Executes the closure f
with an “ambient Tokio runtime” which basically
means that if code in f
tries to get a runtime Handle
it’ll succeed.
If a Handle
is already available, e.g. in async contexts, then f
is run
immediately. Otherwise for synchronous contexts this crate’s fallback
runtime is configured and then f
is executed.