| 572 | /// Asynchronous analog of [`Linker::func_wrap`]. |
| 573 | #[cfg(feature = "async")] |
| 574 | pub fn func_wrap_async<F, Params: crate::WasmTyList, Args: crate::WasmRet>( |
| 575 | &mut self, |
| 576 | module: &str, |
| 577 | name: &str, |
| 578 | func: F, |
| 579 | ) -> Result<&mut Self> |
| 580 | where |
| 581 | F: for<'a> Fn(Caller<'a, T>, Params) -> Box<dyn Future<Output = Args> + Send + 'a> |
| 582 | + Send |
| 583 | + Sync |
| 584 | + 'static, |
| 585 | T: Send + 'static, |
| 586 | { |
| 587 | self.func_insert(module, name, HostFunc::wrap_async(&self.engine, func)?) |
| 588 | } |
| 589 | |
| 590 | /// Convenience wrapper to define an entire [`Instance`] in this linker. |
| 591 | /// |