(mut store: impl AsContextMut<Data = T>, func: F)
| 847 | /// see the [`Func`] documentation. |
| 848 | #[cfg(feature = "async")] |
| 849 | pub fn wrap_async<T, F, P, R>(mut store: impl AsContextMut<Data = T>, func: F) -> Func |
| 850 | where |
| 851 | F: for<'a> Fn(Caller<'a, T>, P) -> Box<dyn Future<Output = R> + Send + 'a> |
| 852 | + Send |
| 853 | + Sync |
| 854 | + 'static, |
| 855 | P: WasmTyList, |
| 856 | R: WasmRet, |
| 857 | T: Send + 'static, |
| 858 | { |
| 859 | let store = store.as_context_mut().0; |
| 860 | let host = HostFunc::wrap_async(store.engine(), func).panic_on_oom(); |
| 861 | |
| 862 | // SAFETY: The `T` the closure takes is the same as the `T` of the store |
| 863 | // we're inserting into via the type signature above. |
| 864 | unsafe { host.into_func(store).panic_on_oom() } |
| 865 | } |
| 866 | |
| 867 | /// Returns the underlying wasm type that this `Func` has. |
| 868 | /// |
nothing calls this directly
no test coverage detected