MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / hello_string

Method hello_string

crates/wiggle/tests/strings.rs:12–23  ·  view source on GitHub ↗
(
        &mut self,
        memory: &mut GuestMemory<'_>,
        a_string: GuestPtr<str>,
    )

Source from the content-addressed store, hash-verified

10
11impl<'a> strings::Strings for WasiCtx<'a> {
12 fn hello_string(
13 &mut self,
14 memory: &mut GuestMemory<'_>,
15 a_string: GuestPtr<str>,
16 ) -> Result<u32, types::Errno> {
17 let s = memory
18 .as_str(a_string)
19 .expect("should be valid string")
20 .expect("expected non-shared memory");
21 println!("a_string='{}'", &*s);
22 Ok(s.len() as u32)
23 }
24
25 fn multi_string(
26 &mut self,

Callers

nothing calls this directly

Calls 4

OkFunction · 0.85
expectMethod · 0.45
as_strMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected