pub trait ExportFunction<WB: WasmBackend>:
Send
+ Sync
+ Clone {
// Required methods
fn signature(&self, store: &mut impl AsContextMut<WB>) -> FuncSig;
fn call_async<'args>(
&'args self,
store: &'args mut impl AsContextMut<WB>,
args: &'args [WValue],
) -> BoxFuture<'args, 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_async<'args>(
&'args self,
store: &'args mut impl AsContextMut<WB>,
args: &'args [WValue],
) -> BoxFuture<'args, RuntimeResult<Vec<WValue>>>
fn call_async<'args>( &'args self, store: &'args mut impl AsContextMut<WB>, args: &'args [WValue], ) -> BoxFuture<'args, RuntimeResult<Vec<WValue>>>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.