pub trait NativeWasmType: Sized {
type Abi: Copy + Debug;
const WASM_TYPE: Type;
// Required methods
fn to_binary(self) -> i128;
fn from_binary(binary: i128) -> Self;
// Provided method
fn to_value<T: WasmValueType>(self) -> Value<T> { ... }
}
Expand description
NativeWasmType
represents a Wasm type that has a direct
representation on the host (hence the “native” term).
It uses the Rust Type system to automatically detect the Wasm type associated with a native Rust type.
use wasmer_types::{NativeWasmType, Type};
let wasm_type = i32::WASM_TYPE;
assert_eq!(wasm_type, Type::I32);
Note: This strategy will be needed later to automatically detect the signature of a Rust function.
Required Associated Constants§
Required Associated Types§
Required Methods§
Sourcefn from_binary(binary: i128) -> Self
fn from_binary(binary: i128) -> Self
Convert to self from i128 binary representation.
Provided Methods§
Sourcefn to_value<T: WasmValueType>(self) -> Value<T>
fn to_value<T: WasmValueType>(self) -> Value<T>
Convert self to a Value
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.