Struct wasmedge_sys::FuncType
source · pub struct FuncType { /* private fields */ }
Expand description
Defines the type of a host function.
A WasmEdge FuncType classifies the signature of a Function, including the type information of both the arguments and the returns.
Implementations§
source§impl FuncType
impl FuncType
sourcepub fn create<I: IntoIterator<Item = ValType>, R: IntoIterator<Item = ValType>>(
args: I,
returns: R
) -> WasmEdgeResult<Self>
pub fn create<I: IntoIterator<Item = ValType>, R: IntoIterator<Item = ValType>>(
args: I,
returns: R
) -> WasmEdgeResult<Self>
Create a new FuncType to be associated with the given arguments and returns.
Arguments
Error
If fail to create a FuncType, then an error is returned.
Example
use wasmedge_sys::FuncType;
use wasmedge_types::ValType;
let func_ty = FuncType::create(vec![ValType::I32;2], vec![ValType::I32]).expect("fail to create a FuncType");
sourcepub fn params_len(&self) -> u32
pub fn params_len(&self) -> u32
Returns the number of the arguments of a Function.
sourcepub fn params_type_iter(&self) -> impl Iterator<Item = ValType>
pub fn params_type_iter(&self) -> impl Iterator<Item = ValType>
Returns an Iterator of the arguments of a Function.
sourcepub fn returns_len(&self) -> u32
pub fn returns_len(&self) -> u32
Returns the number of the returns of a Function.
sourcepub fn returns_type_iter(&self) -> impl Iterator<Item = ValType>
pub fn returns_type_iter(&self) -> impl Iterator<Item = ValType>
Returns an Iterator of the return types of a Function.
sourcepub fn as_ptr(&self) -> *const WasmEdge_FunctionTypeContext
pub fn as_ptr(&self) -> *const WasmEdge_FunctionTypeContext
Provides a raw pointer to the inner function type context.