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

Method get_export_index

crates/wasmtime/src/runtime/module.rs:895–904  ·  view source on GitHub ↗

Looks up an export in this [`Module`] by name to get its index. This function will return the index of an export with the given name. This can be useful to avoid the cost of looking up the export by name multiple times. Instead the [`ModuleExport`] can be stored and used to look up the export on the [`Instance`](crate::Instance) later.

(&self, name: &str)

Source from the content-addressed store, hash-verified

893 /// [`ModuleExport`] can be stored and used to look up the export on the
894 /// [`Instance`](crate::Instance) later.
895 pub fn get_export_index(&self, name: &str) -> Option<ModuleExport> {
896 let compiled_module = self.compiled_module();
897 let module = compiled_module.module();
898 let name = module.strings.get_atom(name)?;
899 let entity = *module.exports.get(&name)?;
900 Some(ModuleExport {
901 module: self.id(),
902 entity,
903 })
904 }
905
906 /// Returns the [`Engine`] that this [`Module`] was compiled by.
907 pub fn engine(&self) -> &Engine {

Callers 13

invoke_componentMethod · 0.45
instance_exportsFunction · 0.45
export_old_get_newFunction · 0.45
export_new_get_oldFunction · 0.45
export_missing_get_maxFunction · 0.45
functions_in_instancesFunction · 0.45
mainFunction · 0.45
test_round_trip_directFunction · 0.45
test_round_trip_manyFunction · 0.45
test_round_tripFunction · 0.45

Calls 5

compiled_moduleMethod · 0.80
get_atomMethod · 0.80
moduleMethod · 0.45
getMethod · 0.45
idMethod · 0.45

Tested by 7

export_old_get_newFunction · 0.36
export_new_get_oldFunction · 0.36
functions_in_instancesFunction · 0.36
test_round_trip_directFunction · 0.36
test_round_trip_manyFunction · 0.36
test_round_tripFunction · 0.36
callMethod · 0.36