(mut store: impl AsContextMut<Data = T>, ty: FuncType, func: F)
| 523 | /// ``` |
| 524 | #[cfg(feature = "async")] |
| 525 | pub fn new_async<T, F>(mut store: impl AsContextMut<Data = T>, ty: FuncType, func: F) -> Func |
| 526 | where |
| 527 | F: for<'a> Fn( |
| 528 | Caller<'a, T>, |
| 529 | &'a [Val], |
| 530 | &'a mut [Val], |
| 531 | ) -> Box<dyn Future<Output = Result<()>> + Send + 'a> |
| 532 | + Send |
| 533 | + Sync |
| 534 | + 'static, |
| 535 | T: Send + 'static, |
| 536 | { |
| 537 | let store = store.as_context_mut().0; |
| 538 | |
| 539 | let host = HostFunc::new_async(store.engine(), ty, func).panic_on_oom(); |
| 540 | |
| 541 | // SAFETY: the `T` used by `func` matches the `T` of the store we're |
| 542 | // inserting into via this function's type signature. |
| 543 | unsafe { host.into_func(store).panic_on_oom() } |
| 544 | } |
| 545 | |
| 546 | /// Creates a new `Func` from a store and a funcref within that store. |
| 547 | /// |
nothing calls this directly
no test coverage detected