Creates a new [`Func`] with the given arguments, although has fewer runtime checks than [`Func::new`]. This function takes a callback of a different signature than [`Func::new`], instead receiving a raw pointer with a list of [`ValRaw`] structures. These values have no type information associated with them so it's up to the caller to provide a function that will correctly interpret the list of va
(
mut store: impl AsContextMut<Data = T>,
ty: FuncType,
func: impl Fn(Caller<'_, T>, &mut [MaybeUninit<ValRaw>]) -> Result<()> + Send + Sync + 'static,
)
| 437 | /// Panics if the given function type is not associated with this store's |
| 438 | /// engine. |
| 439 | pub unsafe fn new_unchecked<T: 'static>( |
| 440 | mut store: impl AsContextMut<Data = T>, |
| 441 | ty: FuncType, |
| 442 | func: impl Fn(Caller<'_, T>, &mut [MaybeUninit<ValRaw>]) -> Result<()> + Send + Sync + 'static, |
| 443 | ) -> Self { |
| 444 | let store = store.as_context_mut().0; |
| 445 | |
| 446 | // SAFETY: the contract required by `new_unchecked` is the same as the |
| 447 | // contract required by this function itself. |
| 448 | let host = unsafe { HostFunc::new_unchecked(store.engine(), ty, func).panic_on_oom() }; |
| 449 | |
| 450 | // SAFETY: the `T` used by `func` matches the `T` of the store we're |
| 451 | // inserting into via this function's type signature. |
| 452 | unsafe { host.into_func(store).panic_on_oom() } |
| 453 | } |
| 454 | |
| 455 | /// Creates a new host-defined WebAssembly function which, when called, |
| 456 | /// will run the asynchronous computation defined by `func` to completion |
nothing calls this directly
no test coverage detected