Struct wasmedge_sdk::Executor
source · pub struct Executor { /* private fields */ }
Expand description
Defines an execution environment for both pure WASM and compiled WASM.
Implementations§
source§impl Executor
impl Executor
sourcepub fn new(
config: Option<&Config>,
stat: Option<&mut Statistics>
) -> WasmEdgeResult<Self>
pub fn new( config: Option<&Config>, stat: Option<&mut Statistics> ) -> WasmEdgeResult<Self>
Creates a new executor to be associated with the given config and statistics.
Arguments
-
config
specifies the configuration of the new executor. -
stat
specifies the statistics needed by the new executor.
Error
If fail to create a executor, then an error is returned.
sourcepub fn run_func(
&self,
func: &Func,
params: impl IntoIterator<Item = WasmValue>
) -> WasmEdgeResult<Vec<WasmValue>>
pub fn run_func( &self, func: &Func, params: impl IntoIterator<Item = WasmValue> ) -> WasmEdgeResult<Vec<WasmValue>>
sourcepub fn run_func_with_timeout(
&self,
func: &Func,
params: impl IntoIterator<Item = WasmValue>,
timeout: Duration
) -> WasmEdgeResult<Vec<WasmValue>>
Available on Linux and non-musl only.
pub fn run_func_with_timeout( &self, func: &Func, params: impl IntoIterator<Item = WasmValue>, timeout: Duration ) -> WasmEdgeResult<Vec<WasmValue>>
sourcepub async fn run_func_async(
&self,
async_state: &AsyncState,
func: &Func,
params: impl IntoIterator<Item = WasmValue> + Send
) -> WasmEdgeResult<Vec<WasmValue>>
Available on crate feature async
and Linux only.
pub async fn run_func_async( &self, async_state: &AsyncState, func: &Func, params: impl IntoIterator<Item = WasmValue> + Send ) -> WasmEdgeResult<Vec<WasmValue>>
async
and Linux only.sourcepub async fn run_func_async_with_timeout(
&self,
async_state: &AsyncState,
func: &Func,
params: impl IntoIterator<Item = WasmValue> + Send,
timeout: Duration
) -> WasmEdgeResult<Vec<WasmValue>>
Available on crate feature async
and Linux and non-musl only.
pub async fn run_func_async_with_timeout( &self, async_state: &AsyncState, func: &Func, params: impl IntoIterator<Item = WasmValue> + Send, timeout: Duration ) -> WasmEdgeResult<Vec<WasmValue>>
async
and Linux and non-musl only.Asynchronously runs a host function instance with a timeout setting.
Arguments
-
async_state
- Used to store asynchronous state at run time. -
func
- The function instance to run. -
params
- The arguments to pass to the function. -
timeout
- The maximum execution time of the function to be run.
Errors
If fail to run the host function, then an error is returned.
sourcepub fn run_func_ref(
&self,
func_ref: &FuncRef,
params: impl IntoIterator<Item = WasmValue>
) -> WasmEdgeResult<Vec<WasmValue>>
pub fn run_func_ref( &self, func_ref: &FuncRef, params: impl IntoIterator<Item = WasmValue> ) -> WasmEdgeResult<Vec<WasmValue>>
sourcepub async fn run_func_ref_async(
&self,
async_state: &AsyncState,
func_ref: &FuncRef,
params: impl IntoIterator<Item = WasmValue> + Send
) -> WasmEdgeResult<Vec<WasmValue>>
Available on crate feature async
and Linux only.
pub async fn run_func_ref_async( &self, async_state: &AsyncState, func_ref: &FuncRef, params: impl IntoIterator<Item = WasmValue> + Send ) -> WasmEdgeResult<Vec<WasmValue>>
async
and Linux only.Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Executor
impl Send for Executor
impl Sync for Executor
impl Unpin for Executor
impl UnwindSafe for Executor
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