summaryrefslogtreecommitdiff
path: root/examples/resumable.rs
diff options
context:
space:
mode:
authorMica White <botahamec@outlook.com>2026-10-31 11:10:49 -0400
committerMica White <botahamec@outlook.com>2026-10-31 11:10:49 -0400
commit264ea48cc8c6dd9c3c9e0fe1a559252863fc9962 (patch)
tree84a4a58de14442f4fcfa06bd0d82480508f82759 /examples/resumable.rs
parent7877eca4e8be283e7c51168ee3a3b05d9000f39c (diff)
parentb45a98a85c776d956a797773acd2f198c06b40ed (diff)
Merge branch 'main' into bota-tortuise
Diffstat (limited to 'examples/resumable.rs')
-rw-r--r--examples/resumable.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/resumable.rs b/examples/resumable.rs
index 0163414..70b0db1 100644
--- a/examples/resumable.rs
+++ b/examples/resumable.rs
@@ -1,4 +1,4 @@
-use eyre::Result;
+use anyhow::Result;
use tinywasm::{ExecProgress, ModuleInstance, Store};
const WASM: &str = r#"
@@ -29,10 +29,12 @@ fn main() -> Result<()> {
let instance = ModuleInstance::instantiate(&mut store, &module, None)?;
let count_down = instance.func::<i32, i32>(&store, "count_down")?;
+ // A resumable call returns execution state instead of running to completion.
let mut execution = count_down.call_resumable(&mut store, 10_000)?;
let fuel_per_round = 128;
let mut fuel_rounds = 0;
+ // Each resume call limits one round. std builds also support wall-clock budgets.
let result = loop {
fuel_rounds += 1;
match execution.resume_with_fuel(fuel_per_round)? {