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§

source

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.

source

fn call( &self, store: &mut impl AsContextMut<WB>, args: &[WValue] ) -> RuntimeResult<Vec<WValue>>

Calls the wasm function.

§Panics:
If given a store different from the one that stores the function.
§Errors:
See `RuntimeError` documentation.

Object Safety§

This trait is not object safe.

Implementors§