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

Method load

crates/tinywasm/src/store/table.rs:71–81  ·  view source on GitHub ↗
(&self, addr: usize, len: usize)

Source from the content-addressed store, hash-verified

69 }
70
71 pub(crate) fn load(&self, addr: usize, len: usize) -> Result<&[TableElement], Trap> {
72 let Some(end) = addr.checked_add(len) else {
73 return Err(self.trap_oob(addr, len));
74 };
75
76 if end > self.elements.len() || end < addr {
77 return Err(self.trap_oob(addr, len));
78 }
79
80 Ok(&self.elements[addr..end])
81 }
82
83 pub(crate) fn copy_within(&mut self, dst: usize, src: usize, len: usize) -> Result<(), Trap> {
84 // Calculate the end of the source slice

Callers 2

exec_load_local_valueMethod · 0.45
exec_table_copyMethod · 0.45

Calls 2

trap_oobMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected