feat: update wasmtime

This commit is contained in:
2022-07-16 16:00:31 +08:00
parent fdee5bef03
commit 4d45c2dbcf
4 changed files with 65 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ fn main() -> Result<()> {
// let engine = Engine::default();
let mut config = Config::default();
config.consume_fuel(true);
config.epoch_interruption(true);
config.static_memory_maximum_size(1_000_000_u64);
config.dynamic_memory_guard_size(0_u64);
let engine = Engine::new(&config).unwrap();
@@ -15,8 +16,12 @@ fn main() -> Result<()> {
let linker = Linker::new(&engine);
let mut store = Store::new(&engine, 4);
store.set_epoch_deadline(10);
let instance = linker.instantiate(&mut store, &module)?;
let hello = instance.get_typed_func::<(i32, i32), i32, _>(&mut store, "add")?;
// let hello2 = instance.get_typed_func::<(&str, i32), i32, _>(&mut store, "add")?;
store.add_fuel(10_000_u64).ok();