feat: update examples
This commit is contained in:
@@ -38,11 +38,11 @@ fn main() -> Result<()> {
|
||||
// println!("memory size: {}", memory.size(&store));
|
||||
|
||||
let msg = "hatter".as_bytes();
|
||||
let malloc_fn = instance.get_typed_func::<i32, i32, _>(&mut store, "__wbindgen_malloc")?;
|
||||
let malloc_fn = instance.get_typed_func::<i32, i32>(&mut store, "__wbindgen_malloc")?;
|
||||
let msg_ptr = malloc_fn.call(&mut store, msg.len() as i32)?;
|
||||
memory.write(&mut store, msg_ptr as usize, msg)?;
|
||||
|
||||
let greet_fn = instance.get_typed_func::<(i32, i32), (), _>(&mut store, "greet")?;
|
||||
let greet_fn = instance.get_typed_func::<(i32, i32), ()>(&mut store, "greet")?;
|
||||
greet_fn.call(&mut store, (msg_ptr, msg.len() as i32))?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user