@@ -99,8 +99,8 @@ use crate::types::{
9999} ;
100100use crate :: wasm:: integer:: RangedInteger ;
101101use crate :: wasm:: runtime:: {
102- AsContext , AsContextMut , Caller , Config , Engine , FuncType , Linker , ValRaw ,
103- ValType ,
102+ AsContext , AsContextMut , Caller , Config , Engine , FuncType , Linker ,
103+ Trampoline , TrampolineResult , ValRaw , ValType ,
104104} ;
105105use crate :: wasm:: string:: RuntimeString ;
106106use crate :: wasm:: string:: String as _;
@@ -279,7 +279,7 @@ impl WasmExport {
279279pub ( crate ) trait WasmExportedFn {
280280 /// Returns the function that will be passed to the selected runtime linker
281281 /// while linking the WASM code to this function.
282- fn trampoline ( & ' static self ) -> TrampolineFn ;
282+ fn trampoline ( & ' static self ) -> Trampoline < ScanContext < ' static , ' static > > ;
283283
284284 /// Returns a [`Vec<ValType>`] with the types of the function's
285285 /// arguments
@@ -302,13 +302,6 @@ pub(crate) trait WasmExportedFn {
302302 }
303303}
304304
305- type TrampolineFn = Box <
306- dyn Fn ( Caller < ' _ , ScanContext > , & mut [ ValRaw ] ) -> wasmtime:: Result < ( ) >
307- + Send
308- + Sync
309- + ' static ,
310- > ;
311-
312305const MAX_RESULTS : usize = 4 ;
313306type WasmResultArray < T > = SmallVec < [ T ; MAX_RESULTS ] > ;
314307
@@ -689,11 +682,11 @@ macro_rules! impl_wasm_exported_fn {
689682 #[ allow( unused_variables) ]
690683 #[ allow( non_snake_case) ]
691684 #[ allow( unused_mut) ]
692- fn trampoline( & ' static self ) -> TrampolineFn {
685+ fn trampoline( & ' static self ) -> Trampoline < ScanContext < ' static , ' static >> {
693686 Box :: new(
694687 |mut caller: Caller <' _, ScanContext >,
695688 args_and_results: & mut [ ValRaw ] |
696- -> wasmtime :: Result < ( ) > {
689+ -> TrampolineResult {
697690 let mut i = 0 ;
698691 $(
699692 let $args = args_and_results[ i] . raw_into( caller. data_mut( ) ) ;
@@ -708,7 +701,7 @@ macro_rules! impl_wasm_exported_fn {
708701
709702 args_and_results[ 0 ..num_results] . clone_from_slice( result_slice) ;
710703
711- wasmtime :: Result :: Ok ( ( ) )
704+ TrampolineResult :: Ok ( ( ) )
712705 } ,
713706 )
714707 }
0 commit comments