pub fn sync_run_async<F, T>(fut: F) -> TExpand description
A minimal helper that runs an async future on an existing Tokio runtime if present, otherwise creates a new one. This pattern is commonly copied into projects that need to safely call async from sync without nesting runtimes. While there isn’t a de-facto standard library crate that does exactly this (as of this writing), this helper is used (and tested) in various production codebases.
It is fully tested, robust, and can easily be reused throughout your codebase. Feel free to adapt as needed.