[]Trait wasmer_runtime::types::WasmExternType

pub unsafe trait WasmExternType: Copy {
    type Native: NativeWasmType;
    fn from_native(native: Self::Native) -> Self;
fn to_native(self) -> Self::Native; }

A trait to convert a Rust value to a WasmNativeType value, or to convert WasmNativeType value to a Rust value.

This trait should ideally be splitted into two traits: FromNativeWasmType and ToNativeWasmType but it creates a non-negligeable complexity in the WasmTypeList implementation.

Associated Types

type Native: NativeWasmType

Native Wasm type.

Loading content...

Required methods

fn from_native(native: Self::Native) -> Self

Convert a value of kind Self::Native to Self.

Panics

This method panics if native cannot fit in the Self type`.

fn to_native(self) -> Self::Native

Convert self to Self::Native.

Panics

This method panics if self cannot fit in the Self::Native type.

Loading content...

Implementations on Foreign Types

impl FromToNativeWasmType for f32

impl FromToNativeWasmType for f64

impl FromToNativeWasmType for u16

impl FromToNativeWasmType for u8

impl FromToNativeWasmType for i16

impl FromToNativeWasmType for i8

impl FromToNativeWasmType for u64

impl FromToNativeWasmType for u32

impl FromToNativeWasmType for i32

impl FromToNativeWasmType for i64

Loading content...

Implementors

impl<T, Ty> FromToNativeWasmType for WasmPtr<T, Ty> where
    T: Copy

type Native = i32

Loading content...