(
mut store: StoreContextMut<Host>,
f: impl FnOnce(&mut GuestProfiler, StoreContext<Host>),
)
| 615 | }; |
| 616 | |
| 617 | fn sample( |
| 618 | mut store: StoreContextMut<Host>, |
| 619 | f: impl FnOnce(&mut GuestProfiler, StoreContext<Host>), |
| 620 | ) { |
| 621 | let mut profiler = store.data_mut().guest_profiler.take().unwrap(); |
| 622 | f( |
| 623 | Arc::get_mut(&mut profiler).expect("profiling doesn't support threads yet"), |
| 624 | store.as_context(), |
| 625 | ); |
| 626 | store.data_mut().guest_profiler = Some(profiler); |
| 627 | } |
| 628 | |
| 629 | store.call_hook(|store, kind| { |
| 630 | sample(store, |profiler, store| profiler.call_hook(store, kind)); |