feat(api,emscritpen,wasi) Update WasmExternType to FromToNativeWasmType.

This commit is contained in:
Ivan Enderlin
2020-06-30 12:10:27 +02:00
parent 12c04fbd94
commit 3f924dbb45
7 changed files with 14 additions and 14 deletions

View File

@@ -3,7 +3,7 @@ mod global;
mod memory;
mod table;
pub use self::function::{Function, HostFunction, WasmExternType, WasmTypeList};
pub use self::function::{FromToNativeWasmType, Function, HostFunction, WasmTypeList};
pub use self::global::Global;
pub use self::memory::Memory;
pub use self::table::Table;

View File

@@ -19,7 +19,7 @@ mod utils;
pub use crate::exports::{ExportError, Exportable, Exports};
pub use crate::externals::{
Extern, Function, Global, HostFunction, Memory, Table, WasmExternType, WasmTypeList,
Extern, FromToNativeWasmType, Function, Global, HostFunction, Memory, Table, WasmTypeList,
};
pub use crate::import_object::{ImportObject, ImportObjectIterator, LikeNamespace};
pub use crate::instance::Instance;

View File

@@ -13,7 +13,7 @@ use crate::externals::function::{
FunctionDefinition, HostFunctionDefinition, VMDynamicFunction, VMDynamicFunctionWithEnv,
VMDynamicFunctionWithoutEnv, WasmFunctionDefinition,
};
use crate::{Function, FunctionType, RuntimeError, Store, WasmExternType, WasmTypeList};
use crate::{FromToNativeWasmType, Function, FunctionType, RuntimeError, Store, WasmTypeList};
use std::panic::{catch_unwind, AssertUnwindSafe};
use wasm_common::NativeWasmType;
use wasmer_runtime::{
@@ -97,7 +97,7 @@ macro_rules! impl_native_traits {
#[allow(unused_parens, non_snake_case)]
impl<'a $( , $x )*, Rets> NativeFunc<'a, ( $( $x ),* ), Rets>
where
$( $x: WasmExternType, )*
$( $x: FromToNativeWasmType, )*
Rets: WasmTypeList,
{
/// Call the typed func and return results.

View File

@@ -6,7 +6,7 @@
//! Therefore, you should use this abstraction whenever possible to avoid memory
//! related bugs when implementing an ABI.
use crate::{externals::Memory, WasmExternType};
use crate::{externals::Memory, FromToNativeWasmType};
use std::{cell::Cell, fmt, marker::PhantomData, mem};
use wasm_common::ValueType;
@@ -218,7 +218,7 @@ impl<T: Copy + ValueType> WasmPtr<T, Array> {
}
}
unsafe impl<T: Copy, Ty> WasmExternType for WasmPtr<T, Ty> {
unsafe impl<T: Copy, Ty> FromToNativeWasmType for WasmPtr<T, Ty> {
type Native = i32;
fn to_native(self) -> Self::Native {