summaryrefslogtreecommitdiff
path: root/examples/reentrance.rs
diff options
context:
space:
mode:
authorHenry Gressmann <mail@henrygressmann.de>2026-08-24 15:47:05 +0200
committerGitHub <noreply@github.com>2026-08-24 15:47:05 +0200
commit7b9b3ec681e68280399d9c67e01433c2d3acb6c2 (patch)
treeb6000a9755d50fe1ba6f93de6ed784deb179ae49 /examples/reentrance.rs
parent3e2e964f70e6128b891fa3b43f73a821493bd7bc (diff)
feat: add host typed reference / gc APIs (#54)
- add Store-aware handles for references, GC objects, and exceptions - simplify host value conversion, rooting, and exception propagation - update examples, tests, and documentation - Remove deprecated APIs Signed-off-by: Henry <mail@henrygressmann.de>
Diffstat (limited to 'examples/reentrance.rs')
-rw-r--r--examples/reentrance.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/reentrance.rs b/examples/reentrance.rs
index 0084a61..cf57891 100644
--- a/examples/reentrance.rs
+++ b/examples/reentrance.rs
@@ -23,10 +23,11 @@ fn main() -> Result<()> {
let mut store = Store::default();
let call_add_twice = HostFunction::from(|mut ctx: FuncContext<'_>, value: i32| {
+ // FuncContext exposes the active module and its Store to the callback.
let add_one = ctx.module().func::<i32, i32>(ctx.store(), "add_one")?;
- // Use ctx.call for reentrant calls from host functions. Function::call
- // starts a root invocation and cannot preserve the active call stacks.
+ // Use ctx.call while a host callback has an active Wasm invocation.
+ // Function::call only starts top-level invocations.
let value = ctx.call(&add_one, value)?;
ctx.call(&add_one, value)
});