feat(api) Remove the WasmExternTypeInner trait.

I believe this trait is no longer necessary since `WasmExternType` has
been moved inside the `wasmer` crate itself (this crate).

See https://github.com/wasmerio/wasmer-reborn/pull/121.

`cargo check` and `cargo test` agrees.

Also, this trait is annoying to implement abstraction over
`NativeFunc` since it is not re-exported outside of the crate.
This commit is contained in:
Ivan Enderlin
2020-06-25 16:55:36 +02:00
parent b78b490e85
commit 2d025c24ea

View File

@@ -92,32 +92,12 @@ where
}
}
/// Marker trait to make Rust happy: required to allow `NativeFunc<i32>` work.
/// without this trait, the singleton case looks like a generic impl in the macro
/// expansion and Rust will not compile this code because it's a potential duplicate
/// with all the existing tuples for which this is also being implemented.
pub unsafe trait WasmExternTypeInner: Copy + WasmExternType
where
Self: Sized,
{
}
unsafe impl WasmExternTypeInner for i8 {}
unsafe impl WasmExternTypeInner for u8 {}
unsafe impl WasmExternTypeInner for i16 {}
unsafe impl WasmExternTypeInner for u16 {}
unsafe impl WasmExternTypeInner for i32 {}
unsafe impl WasmExternTypeInner for u32 {}
unsafe impl WasmExternTypeInner for i64 {}
unsafe impl WasmExternTypeInner for u64 {}
unsafe impl WasmExternTypeInner for f32 {}
unsafe impl WasmExternTypeInner for f64 {}
macro_rules! impl_native_traits {
( $( $x:ident ),* ) => {
#[allow(unused_parens, non_snake_case)]
impl<'a $( , $x )*, Rets> NativeFunc<'a, ( $( $x ),* ), Rets>
where
$( $x: WasmExternType + WasmExternTypeInner, )*
$( $x: WasmExternType, )*
Rets: WasmTypeList,
{
/// Call the typed func and return results.