mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-07 05:08:19 +00:00
Create single interface to get exports from Instance.exports
This adds a method that takes generic arguments as well so that NativeFunc<Args, Rets> can also be `got` even though it has generic parameters
This commit is contained in:
@@ -201,6 +201,17 @@ macro_rules! impl_native_traits {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, $( $x, )* Rets> crate::exports::ExportableWithGenerics<'a, ($( $x ),*), Rets> for NativeFunc<( $( $x ),* ), Rets>
|
||||
where
|
||||
$( $x: FromToNativeWasmType, )*
|
||||
Rets: WasmTypeList,
|
||||
{
|
||||
fn get_self_from_extern_with_generics(_extern: &crate::externals::Extern) -> Result<Self, crate::exports::ExportError> {
|
||||
use crate::exports::Exportable;
|
||||
crate::Function::get_self_from_extern(_extern)?.native().map_err(|_| crate::exports::ExportError::IncompatibleType)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user