Skip to main content

run_async

Function run_async 

Source
pub fn run_async<F, T, E>(f: F) -> Result<T, ModuleError>
where F: Future<Output = Result<T, E>>, E: Display,
Expand description

Run an async future from a sync context (e.g. CLI handler). Blocks the current thread and executes the future on the current runtime. Use when #[command] methods need to call async APIs.

When the future only returns Ok(_) with no error path, use Ok::<_, String>(...) to fix inference.