diff options
| author | Henry <mail@henrygressmann.de> | 2026-08-09 16:11:57 +0200 |
|---|---|---|
| committer | Henry <mail@henrygressmann.de> | 2026-08-09 16:11:57 +0200 |
| commit | 9893a51d2712f82a2ee57316a66bc26500eb3fdd (patch) | |
| tree | 55578e887155323c57f05ac1905c552af82f5767 /examples/reentrance.rs | |
| parent | 8ca9c3580990bc973218d944f2262a7d98a8380e (diff) | |
feat: add reusable host imports and simplify function calls
- make host definitions reusable across stores with gc-aware import linking
- reorganize function calls, resumable execution, and typed value handling
- expand typed tuples to arity 20 and update parser and store APIs
Signed-off-by: Henry <mail@henrygressmann.de>
Diffstat (limited to 'examples/reentrance.rs')
| -rw-r--r-- | examples/reentrance.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/reentrance.rs b/examples/reentrance.rs index 432fac7..8a1988e 100644 --- a/examples/reentrance.rs +++ b/examples/reentrance.rs @@ -22,7 +22,7 @@ fn main() -> Result<()> { let module = tinywasm::parse_bytes(&wasm)?; let mut store = Store::default(); - let call_add_twice = HostFunction::from(&mut store, |mut ctx: FuncContext<'_>, value: i32| { + let call_add_twice = HostFunction::from(|mut ctx: FuncContext<'_>, value: i32| { let add_one = ctx.module().func::<i32, i32>(ctx.store(), "add_one")?; // Use ctx.call for reentrant calls from host functions. Function::call @@ -34,7 +34,7 @@ fn main() -> Result<()> { let mut imports = Imports::new(); imports.define("host", "call_add_twice", call_add_twice); - let instance = ModuleInstance::instantiate(&mut store, &module, Some(imports))?; + let instance = ModuleInstance::instantiate(&mut store, &module, Some(&imports))?; let run = instance.func::<i32, i32>(&store, "run")?; assert_eq!(run.call(&mut store, 40)?, 52); |
