diff options
| author | Henry <mail@henrygressmann.de> | 2026-04-18 23:27:42 +0200 |
|---|---|---|
| committer | Henry <mail@henrygressmann.de> | 2026-04-18 23:27:42 +0200 |
| commit | 8a6d8648c307384686a7db907e8d6cbbdb1f4f24 (patch) | |
| tree | 3dfec1b9ab0d639506ed0239fb9860c6c7e2e4a4 /examples/wasm-rust.rs | |
| parent | 77cf2a6812f5563f902479175cc8b59502ce233c (diff) | |
feat: memory backend api
Signed-off-by: Henry <mail@henrygressmann.de>
Diffstat (limited to 'examples/wasm-rust.rs')
| -rw-r--r-- | examples/wasm-rust.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/wasm-rust.rs b/examples/wasm-rust.rs index 2d2b91a..928b9e1 100644 --- a/examples/wasm-rust.rs +++ b/examples/wasm-rust.rs @@ -107,7 +107,7 @@ fn hello() -> Result<()> { let print_utf8 = HostFunction::from(&mut store, |ctx: FuncContext<'_>, (ptr, len): (i64, i32)| { let mem = ctx.memory("memory")?; - let string = mem.load_string(ctx.store(), ptr as usize, len as usize)?; + let string = mem.read_string(ctx.store(), ptr as usize, len as usize)?; println!("{string}"); Ok(()) }); @@ -119,7 +119,7 @@ fn hello() -> Result<()> { let arg_ptr = instance.func::<(), i32>(&store, "arg_ptr")?.call(&mut store, ())?; let arg = b"world"; - instance.memory("memory")?.store(&mut store, arg_ptr as usize, arg)?; + instance.memory("memory")?.copy_from_slice(&mut store, arg_ptr as usize, arg)?; let hello = instance.func::<i32, ()>(&store, "hello")?; hello.call(&mut store, arg.len() as i32)?; |
