logo
pub unsafe trait FromToNativeWasmType where
    Self: Sized
{ type Native: NativeWasmTypeInto; fn from_native(native: Self::Native) -> Self; fn to_native(self) -> Self::Native; fn is_from_store(&self, _store: &impl AsStoreRef) -> bool { ... } }
Expand description

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 split into two traits: FromNativeWasmType and ToNativeWasmType but it creates a non-negligible complexity in the WasmTypeList implementation.

Safety

This trait is unsafe given the nature of how values are written and read from the native stack

Required Associated Types

Native Wasm type.

Required Methods

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

Panics

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

Convert self to Self::Native.

Panics

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

Provided Methods

Returns whether the given value is from the given store.

This always returns true for primitive types that can be used with any context.

Implementations on Foreign Types

Implementors