Struct wasmedge_sys::instance::function::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
Available on crate feature ffi
only.
pub fn as_ptr(&self) -> *const WasmEdge_FunctionTypeContext
ffi
only.Provides a raw pointer to the inner function type context.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for FuncType
impl Send for FuncType
impl Sync for FuncType
impl Unpin for FuncType
impl UnwindSafe for FuncType
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more