MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / get_module_export

Method get_module_export

crates/wasmtime/src/runtime/instance.rs:460–473  ·  view source on GitHub ↗

Looks up an exported [`Extern`] value by a [`ModuleExport`] value. This is similar to [`Instance::get_export`] but uses a [`ModuleExport`] value to avoid string lookups where possible. [`ModuleExport`]s can be obtained by calling [`Module::get_export_index`] on the [`Module`] that this instance was instantiated with. This method will search the module for an export with a matching entity index a

(
        &self,
        mut store: impl AsContextMut,
        export: &ModuleExport,
    )

Source from the content-addressed store, hash-verified

458 ///
459 /// Panics if `store` does not own this instance.
460 pub fn get_module_export(
461 &self,
462 mut store: impl AsContextMut,
463 export: &ModuleExport,
464 ) -> Option<Extern> {
465 let store = store.as_context_mut().0;
466
467 // Verify the `ModuleExport` matches the module used in this instance.
468 if self._module(store).id() != export.module {
469 return None;
470 }
471
472 Some(self._get_export(store, export.entity))
473 }
474
475 fn _get_export(&self, store: &mut StoreOpaque, entity: EntityIndex) -> Extern {
476 let id = store.id();

Callers

nothing calls this directly

Calls 4

_moduleMethod · 0.80
as_context_mutMethod · 0.45
idMethod · 0.45
_get_exportMethod · 0.45

Tested by

no test coverage detected