@@ -2,7 +2,7 @@ use criterion::{BatchSize, Criterion, criterion_group, criterion_main};
22use eyre:: Result ;
33use tinywasm:: engine:: { Config , FuelPolicy } ;
44use tinywasm:: types:: TinyWasmModule ;
5- use tinywasm:: { Engine , ExecProgress , Extern , FuncContext , FuncHandleTyped , Imports , ModuleInstance , Store } ;
5+ use tinywasm:: { Engine , ExecProgress , FuncContext , FunctionTyped , HostFunction , Imports , ModuleInstance , Store } ;
66
77const WASM : & [ u8 ] = include_bytes ! ( "../../../examples/rust/out/tinywasm.wasm" ) ;
88const FUEL_PER_ROUND : u32 = 512 ;
@@ -14,26 +14,26 @@ fn tinywasm_parse() -> Result<TinyWasmModule> {
1414 Ok ( parser. parse_module_bytes ( WASM ) ?)
1515}
1616
17- fn setup_typed_func ( module : TinyWasmModule , engine : Option < Engine > ) -> Result < ( Store , FuncHandleTyped < ( ) , ( ) > ) > {
17+ fn setup_typed_func ( module : TinyWasmModule , engine : Option < Engine > ) -> Result < ( Store , FunctionTyped < ( ) , ( ) > ) > {
1818 let mut store = match engine {
1919 Some ( engine) => Store :: new ( engine) ,
2020 None => Store :: default ( ) ,
2121 } ;
2222
2323 let mut imports = Imports :: default ( ) ;
24- imports. define ( "env" , "printi32" , Extern :: typed_func ( |_: FuncContext < ' _ > , _: i32 | Ok ( ( ) ) ) ) ? ;
24+ imports. define ( "env" , "printi32" , HostFunction :: from ( & mut store , |_: FuncContext < ' _ > , _: i32 | Ok ( ( ) ) ) ) ;
2525
2626 let instance = ModuleInstance :: instantiate ( & mut store, module. into ( ) , Some ( imports) ) ?;
27- let func = instance. func_typed :: < ( ) , ( ) > ( & store, "hello" ) ?;
27+ let func = instance. func :: < ( ) , ( ) > ( & store, "hello" ) ?;
2828 Ok ( ( store, func) )
2929}
3030
31- fn run_call ( store : & mut Store , func : & FuncHandleTyped < ( ) , ( ) > ) -> Result < ( ) > {
31+ fn run_call ( store : & mut Store , func : & FunctionTyped < ( ) , ( ) > ) -> Result < ( ) > {
3232 func. call ( store, ( ) ) ?;
3333 Ok ( ( ) )
3434}
3535
36- fn run_resume_with_fuel ( store : & mut Store , func : & FuncHandleTyped < ( ) , ( ) > ) -> Result < ( ) > {
36+ fn run_resume_with_fuel ( store : & mut Store , func : & FunctionTyped < ( ) , ( ) > ) -> Result < ( ) > {
3737 let mut execution = func. call_resumable ( store, ( ) ) ?;
3838 loop {
3939 match execution. resume_with_fuel ( FUEL_PER_ROUND ) ? {
@@ -43,7 +43,7 @@ fn run_resume_with_fuel(store: &mut Store, func: &FuncHandleTyped<(), ()>) -> Re
4343 }
4444}
4545
46- fn run_resume_with_time_budget ( store : & mut Store , func : & FuncHandleTyped < ( ) , ( ) > ) -> Result < ( ) > {
46+ fn run_resume_with_time_budget ( store : & mut Store , func : & FunctionTyped < ( ) , ( ) > ) -> Result < ( ) > {
4747 let mut execution = func. call_resumable ( store, ( ) ) ?;
4848 loop {
4949 match execution. resume_with_time_budget ( TIME_BUDGET_PER_ROUND ) ? {
0 commit comments