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

Method read_string

crates/tinywasm/src/reference.rs:310–313  ·  view source on GitHub ↗

Reads a UTF-8 string from memory.

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

Source from the content-addressed store, hash-verified

308
309 /// Reads a UTF-8 string from memory.
310 pub fn read_string(&self, store: &Store, offset: usize, len: usize) -> Result<String> {
311 String::from_utf8(self.read_vec(store, offset, len)?)
312 .map_err(|e| crate::Error::Other(format!("Invalid UTF-8 string: {e}")))
313 }
314
315 /// Reads a JavaScript-style utf-16 string from memory.
316 pub fn read_js_string(&self, store: &Store, offset: usize, len: usize) -> Result<String> {

Callers 1

helloFunction · 0.80

Calls 1

read_vecMethod · 0.45

Tested by

no test coverage detected