MCPcopy Index your code
hub / github.com/explodingcamera/tinywasm / elem_addr

Method elem_addr

crates/tinywasm/src/store/mod.rs:396–411  ·  view source on GitHub ↗
(&self, item: &ElementItem, globals: &[Addr], funcs: &[FuncAddr])

Source from the content-addressed store, hash-verified

394 }
395
396 fn elem_addr(&self, item: &ElementItem, globals: &[Addr], funcs: &[FuncAddr]) -> Result<Option<u32>> {
397 let res = match item {
398 ElementItem::Func(addr) => match funcs.get(*addr as usize) {
399 Some(func_addr) => Some(*func_addr),
400 None => {
401 cold_path();
402 return Err(Error::Other(format!(
403 "function {addr} not found. This should have been caught by the validator"
404 )));
405 }
406 },
407 ElementItem::Expr(expr) => self.eval_ref_const(expr, globals, funcs)?,
408 };
409
410 Ok(res)
411 }
412
413 /// Add elements to the store, returning their addresses in the store
414 /// Should be called after the tables have been added

Callers 1

init_elementsMethod · 0.80

Calls 2

eval_ref_constMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected