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

Method read_cstring

crates/tinywasm/src/reference.rs:293–296  ·  view source on GitHub ↗

Reads a C-style string from memory.

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

Source from the content-addressed store, hash-verified

291
292 /// Reads a C-style string from memory.
293 pub fn read_cstring(&self, store: &Store, offset: usize, len: usize) -> Result<CString> {
294 CString::from_vec_with_nul(self.read_vec(store, offset, len)?)
295 .map_err(|e| crate::Error::Other(format!("Invalid C-style string: {e}")))
296 }
297
298 /// Reads a C-style string from memory, stopping at the first null byte.
299 pub fn read_cstring_until_null(&self, store: &Store, offset: usize, max_len: usize) -> Result<CString> {

Callers

nothing calls this directly

Calls 1

read_vecMethod · 0.45

Tested by

no test coverage detected