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

Method functions

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

Get information about functions in this module's `.text` section: their index, name, and offset+length. Results are yielded in a ModuleFunction struct.

(&'a self)

Source from the content-addressed store, hash-verified

1089 ///
1090 /// Results are yielded in a ModuleFunction struct.
1091 pub fn functions<'a>(&'a self) -> impl ExactSizeIterator<Item = ModuleFunction> + 'a {
1092 let module = self.compiled_module();
1093 let module_index = self.env_module().module_index;
1094 self.env_module().defined_func_indices().map(move |idx| {
1095 let key = FuncKey::DefinedWasmFunction(module_index, idx);
1096 let loc = module.func_loc(key);
1097 let idx = module.module().func_index(idx);
1098 ModuleFunction {
1099 module: module_index,
1100 index: idx,
1101 name: module.func_name(idx).map(|n| n.to_string()),
1102 offset: loc.start as usize,
1103 len: loc.length as usize,
1104 }
1105 })
1106 }
1107
1108 pub(crate) fn id(&self) -> CompiledModuleId {
1109 self.inner.module.unique_id()

Callers 2

executeMethod · 0.45
annotate_asmFunction · 0.45

Calls 9

compiled_moduleMethod · 0.80
defined_func_indicesMethod · 0.80
env_moduleMethod · 0.45
mapMethod · 0.45
func_locMethod · 0.45
func_indexMethod · 0.45
moduleMethod · 0.45
func_nameMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected