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

Method read_exact

crates/tinywasm/src/reference.rs:228–236  ·  view source on GitHub ↗

Reads exactly `dst.len()` bytes from memory.

(&self, store: &Store, offset: usize, dst: &mut [u8])

Source from the content-addressed store, hash-verified

226
227 /// Reads exactly `dst.len()` bytes from memory.
228 pub fn read_exact(&self, store: &Store, offset: usize, dst: &mut [u8]) -> Result<()> {
229 self.instance(store)?.inner.read_exact(offset, dst).ok_or_else(|| {
230 Error::Trap(crate::Trap::MemoryOutOfBounds {
231 offset,
232 len: dst.len(),
233 max: self.instance(store).unwrap().inner.len(),
234 })
235 })
236 }
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>> {

Calls 3

TrapEnum · 0.85
instanceMethod · 0.80
lenMethod · 0.45