pub trait ExportFunction<WB: WasmBackend>: Send + Sync + Clone {
// Required methods
fn signature(&self, store: &mut impl AsContextMut<WB>) -> FuncSig;
fn call(
&self,
store: &mut impl AsContextMut<WB>,
args: &[WValue]
) -> RuntimeResult<Vec<WValue>>;
}
Expand description
A Wasm function handle, it can be either a function from a host or an export from an Instance
.
As it is only a handle to an object in Store
, cloning is cheap
Required Methods§
sourcefn signature(&self, store: &mut impl AsContextMut<WB>) -> FuncSig
fn signature(&self, store: &mut impl AsContextMut<WB>) -> FuncSig
Returns the signature of the function. The signature is constructed each time this function is called, so it is not recommended to use this function extensively.
sourcefn call(
&self,
store: &mut impl AsContextMut<WB>,
args: &[WValue]
) -> RuntimeResult<Vec<WValue>>
fn call( &self, store: &mut impl AsContextMut<WB>, args: &[WValue] ) -> RuntimeResult<Vec<WValue>>
Object Safety§
This trait is not object safe.