Creates a [`Func::new`]-style function named in this linker. For more information see [`Linker::func_wrap`]. # Panics Panics if the given function type is not associated with the same engine as this linker. # Errors This function will return an [`OutOfMemory`][crate::OutOfMemory] error when memory allocation fails. See the `OutOfMemory` type's documentation for details on Wasmtime's out-of-me
(
&mut self,
module: &str,
name: &str,
ty: FuncType,
func: impl Fn(Caller<'_, T>, &[Val], &mut [Val]) -> Result<()> + Send + Sync + 'static,
)
| 426 | /// memory allocation fails. See the `OutOfMemory` type's documentation for |
| 427 | /// details on Wasmtime's out-of-memory handling. |
| 428 | pub fn func_new( |
| 429 | &mut self, |
| 430 | module: &str, |
| 431 | name: &str, |
| 432 | ty: FuncType, |
| 433 | func: impl Fn(Caller<'_, T>, &[Val], &mut [Val]) -> Result<()> + Send + Sync + 'static, |
| 434 | ) -> Result<&mut Self> |
| 435 | where |
| 436 | T: 'static, |
| 437 | { |
| 438 | self.func_insert(module, name, HostFunc::new(&self.engine, ty, func)?) |
| 439 | } |
| 440 | |
| 441 | /// Creates a [`Func::new_unchecked`]-style function named in this linker. |
| 442 | /// |