Trait wasmer_types::NativeWasmType[][src]

pub trait NativeWasmType: Sized {
    type Abi: Copy + Debug;

    const WASM_TYPE: Type;

    fn to_binary(self) -> i128;
fn from_binary(binary: i128) -> Self; 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.

Associated Types

type Abi: Copy + Debug[src]

The ABI for this type (i32, i64, f32, f64)

Associated Constants

const WASM_TYPE: Type[src]

Type for this NativeWasmType.

Required methods

fn to_binary(self) -> i128[src]

Convert self to i128 binary representation.

fn from_binary(binary: i128) -> Self[src]

Convert to self from i128 binary representation.

Provided methods

fn to_value<T: WasmValueType>(self) -> Value<T>[src]

Convert self to a Value.

Implementations on Foreign Types

impl NativeWasmType for i32[src]

const WASM_TYPE: Type[src]

type Abi = Self

fn from_abi(abi: Self::Abi) -> Self[src]

fn into_abi(self) -> Self::Abi[src]

fn to_binary(self) -> i128[src]

fn from_binary(bits: i128) -> Self[src]

impl NativeWasmType for i64[src]

const WASM_TYPE: Type[src]

type Abi = Self

fn from_abi(abi: Self::Abi) -> Self[src]

fn into_abi(self) -> Self::Abi[src]

fn to_binary(self) -> i128[src]

fn from_binary(bits: i128) -> Self[src]

impl NativeWasmType for f32[src]

const WASM_TYPE: Type[src]

type Abi = Self

fn from_abi(abi: Self::Abi) -> Self[src]

fn into_abi(self) -> Self::Abi[src]

fn to_binary(self) -> i128[src]

fn from_binary(bits: i128) -> Self[src]

impl NativeWasmType for f64[src]

const WASM_TYPE: Type[src]

type Abi = Self

fn from_abi(abi: Self::Abi) -> Self[src]

fn into_abi(self) -> Self::Abi[src]

fn to_binary(self) -> i128[src]

fn from_binary(bits: i128) -> Self[src]

impl NativeWasmType for u128[src]

const WASM_TYPE: Type[src]

type Abi = Self

fn from_abi(abi: Self::Abi) -> Self[src]

fn into_abi(self) -> Self::Abi[src]

fn to_binary(self) -> i128[src]

fn from_binary(bits: i128) -> Self[src]

Implementors

impl NativeWasmType for VMExternRef[src]

const WASM_TYPE: Type[src]

type Abi = Self

fn from_abi(abi: Self::Abi) -> Self[src]

fn into_abi(self) -> Self::Abi[src]

fn to_binary(self) -> i128[src]

fn from_binary(bits: i128) -> Self[src]