pub fn run_async<T, Fut, C>(fut: Fut, cancel: Option<CancelToken>, complete: C)Expand description
Run an async export to completion and deliver its result exactly once.
fut is the producer’s work, already mapped to Result<T, FfiError> (a
domain error becomes its FfiError); complete lowers the outcome
into the C completion callback’s slots and invokes it. The runtime calls
complete exactly once:
- with
fut’s result when it resolves; - with a
PANIC_ERROR_CODEerror when polling it panics; - with
CANCELLED_ERROR_CODEas soon ascancelfires, after droppingfut, or when the executor drops the task before it resolves; - with
GENERIC_ERROR_CODEwhen the executor can’t take the task (seespawn).