Trait wasmer::WasmTypeList
source · [−]pub trait WasmTypeList where
Self: Sized, {
type CStruct;
type Array: AsMut<[i128]>;
fn from_array(array: Self::Array) -> Self;
fn from_slice(slice: &[i128]) -> Result<Self, TryFromSliceError>;
fn into_array(self) -> Self::Array;
fn empty_array() -> Self::Array;
fn from_c_struct(c_struct: Self::CStruct) -> Self;
fn into_c_struct(self) -> Self::CStruct;
fn wasm_types() -> &'static [Type];
}
Expand description
The WasmTypeList
trait represents a tuple (list) of Wasm
typed values. It is used to get low-level representation of
such a tuple.
Required Associated Types
Required Methods
fn from_array(array: Self::Array) -> Self
fn from_array(array: Self::Array) -> Self
Constructs Self
based on an array of values.
fn from_slice(slice: &[i128]) -> Result<Self, TryFromSliceError>
fn from_slice(slice: &[i128]) -> Result<Self, TryFromSliceError>
Constructs Self
based on a slice of values.
from_slice
returns a Result
because it is possible
that the slice doesn’t have the same size than
Self::Array
, in which circumstance an error of kind
TryFromSliceError
will be returned.
fn into_array(self) -> Self::Array
fn into_array(self) -> Self::Array
Builds and returns an array of type Array
from a tuple
(list) of values.
fn empty_array() -> Self::Array
fn empty_array() -> Self::Array
Allocates and return an empty array of type Array
that
will hold a tuple (list) of values, usually to hold the
returned values of a WebAssembly function call.
fn from_c_struct(c_struct: Self::CStruct) -> Self
fn from_c_struct(c_struct: Self::CStruct) -> Self
Builds a tuple (list) of values from a C struct of type
CStruct
.
fn into_c_struct(self) -> Self::CStruct
fn into_c_struct(self) -> Self::CStruct
Builds and returns a C struct of type CStruct
from a
tuple (list) of values.
fn wasm_types() -> &'static [Type]
fn wasm_types() -> &'static [Type]
Get the Wasm types for the tuple (list) of currently represented values.