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

Method get_export

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

Looks up an exported [`Extern`] value by name. This method will search the module for an export named `name` and return the value, if found. Returns `None` if there was no export named `name`. # Panics Panics if `store` does not own this instance. # Why does `get_export` take a mutable context? This method requires a mutable context because an instance's exports are lazily populated, and we

(&self, mut store: impl AsContextMut, name: &str)

Source from the content-addressed store, hash-verified

436 /// instantiating a module faster, but also means this method requires a
437 /// mutable context.
438 pub fn get_export(&self, mut store: impl AsContextMut, name: &str) -> Option<Extern> {
439 let store = store.as_context_mut().0;
440 let module = store[self.id].env_module();
441 let name = module.strings.get_atom(name)?;
442 let entity = *module.exports.get(&name)?;
443 Some(self._get_export(store, entity))
444 }
445
446 /// Looks up an exported [`Extern`] value by a [`ModuleExport`] value.
447 ///

Callers 7

get_funcMethod · 0.45
get_typed_funcMethod · 0.45
get_tableMethod · 0.45
get_memoryMethod · 0.45
get_shared_memoryMethod · 0.45
get_globalMethod · 0.45
get_tagMethod · 0.45

Calls 5

get_atomMethod · 0.80
as_context_mutMethod · 0.45
env_moduleMethod · 0.45
getMethod · 0.45
_get_exportMethod · 0.45

Tested by

no test coverage detected