Defines a new host-provided function into this [`LinkerInstance`]. This method is used to give host functions to wasm components. The `func` provided will be callable from linked components with the type signature dictated by `Params` and `Return`. The `Params` is a tuple of types that will come from wasm and `Return` is a value coming from the host going back to wasm. Additionally the `func` ta
(&mut self, name: &str, func: F)
| 471 | // |
| 472 | // TODO: needs more words and examples |
| 473 | pub fn func_wrap<F, Params, Return>(&mut self, name: &str, func: F) -> Result<()> |
| 474 | where |
| 475 | F: Fn(StoreContextMut<T>, Params) -> Result<Return> + Send + Sync + 'static, |
| 476 | Params: ComponentNamedList + Lift + 'static, |
| 477 | Return: ComponentNamedList + Lower + 'static, |
| 478 | { |
| 479 | self.insert(name, Definition::Func(HostFunc::func_wrap(func)?))?; |
| 480 | Ok(()) |
| 481 | } |
| 482 | |
| 483 | /// Defines a new host-provided async function into this [`LinkerInstance`]. |
| 484 | /// |