Creates a new `Func` from the given Rust closure. This function will create a new `Func` which, when called, will execute the given Rust closure. Unlike [`Func::new`] the target function being called is known statically so the type signature can be inferred. Rust types will map to WebAssembly types as follows: | Rust Argument Type | WebAssembly Type | |---
(
store: impl AsContextMut<Data = T>,
func: impl IntoFunc<T, Params, Results>,
)
| 807 | /// # } |
| 808 | /// ``` |
| 809 | pub fn wrap<T, Params, Results>( |
| 810 | store: impl AsContextMut<Data = T>, |
| 811 | func: impl IntoFunc<T, Params, Results>, |
| 812 | ) -> Func |
| 813 | where |
| 814 | T: 'static, |
| 815 | { |
| 816 | Self::try_wrap(store, func).expect( |
| 817 | "allocation failure during `Func::wrap` (use `Func::try_wrap` to handle such errors)", |
| 818 | ) |
| 819 | } |
| 820 | |
| 821 | /// Fallible version of [`Func::wrap`] that returns an error on |
| 822 | /// out-of-memory instead of panicking. |
nothing calls this directly
no test coverage detected