MCPcopy Create free account
hub / github.com/explodingcamera/tinywasm / get_wasm_func

Method get_wasm_func

crates/tinywasm/src/store/mod.rs:152–160  ·  view source on GitHub ↗

Get a wasm function at the actual index in the store, panicking if it's a host function (which should be guaranteed by the validator)

(&self, addr: FuncAddr)

Source from the content-addressed store, hash-verified

150
151 /// Get a wasm function at the actual index in the store, panicking if it's a host function (which should be guaranteed by the validator)
152 pub(crate) fn get_wasm_func(&self, addr: FuncAddr) -> &WasmFunctionInstance {
153 match self.funcs.get(addr as usize) {
154 Some(FunctionInstance::Wasm(wasm_func)) => wasm_func,
155 _ => {
156 cold_path();
157 unreachable!("function {addr} not found. This should be unreachable")
158 }
159 }
160 }
161
162 /// Get the memory at the actual index in the store
163 pub(crate) fn get_mem(&self, addr: MemAddr) -> &MemoryInstance {

Callers 3

newMethod · 0.80
exec_returnMethod · 0.80
finish_returnMethod · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected