Returns the list of exported items from this [`Instance`]. # Panics Panics if `store` does not own this instance, or if memory allocation fails.
(
&'a self,
store: impl Into<StoreContextMut<'a, T>>,
)
| 395 | /// Panics if `store` does not own this instance, or if memory allocation |
| 396 | /// fails. |
| 397 | pub fn exports<'a, T: 'static>( |
| 398 | &'a self, |
| 399 | store: impl Into<StoreContextMut<'a, T>>, |
| 400 | ) -> impl ExactSizeIterator<Item = Export<'a>> + 'a { |
| 401 | let store = store.into().0; |
| 402 | let store_id = store.id(); |
| 403 | let engine = store.engine().clone(); |
| 404 | |
| 405 | let (instance, registry) = store.instance_and_module_registry_mut(self.id()); |
| 406 | let (module, mut instance) = instance.module_and_self(); |
| 407 | module.exports.iter().map(move |(name, entity)| { |
| 408 | // SAFETY: the `store_id` owns this instance and all exports |
| 409 | // contained within. |
| 410 | let export = unsafe { |
| 411 | instance |
| 412 | .as_mut() |
| 413 | .get_export_by_index_mut(registry, store_id, *entity) |
| 414 | }; |
| 415 | |
| 416 | let ext = Extern::from_wasmtime_export(export, &engine); |
| 417 | Export::new(&module.strings[name], ext) |
| 418 | }) |
| 419 | } |
| 420 | |
| 421 | /// Looks up an exported [`Extern`] value by name. |
| 422 | /// |
nothing calls this directly
no test coverage detected