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

Method read_vec

crates/tinywasm/src/reference.rs:239–243  ·  view source on GitHub ↗

Reads `len` bytes from memory into a newly allocated buffer.

(&self, store: &Store, offset: usize, len: usize)

Source from the content-addressed store, hash-verified

237
238 /// Reads `len` bytes from memory into a newly allocated buffer.
239 pub fn read_vec(&self, store: &Store, offset: usize, len: usize) -> Result<Vec<u8>> {
240 self.instance(store)?.inner.read_vec(offset, len).ok_or_else(|| {
241 Error::Trap(crate::Trap::MemoryOutOfBounds { offset, len, max: self.instance(store).unwrap().inner.len() })
242 })
243 }
244
245 /// Grow the memory by the given number of pages.
246 pub fn grow(&self, store: &mut Store, delta_pages: i64) -> Result<Option<i64>> {

Callers 5

build_importsFunction · 0.45
read_cstringMethod · 0.45
read_stringMethod · 0.45
read_js_stringMethod · 0.45

Calls 3

TrapEnum · 0.85
instanceMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected