ExportFunction

Trait ExportFunction 

Source
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§

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_async<'args>( &'args self, store: &'args mut impl AsContextMut<WB>, args: &'args [WValue], ) -> BoxFuture<'args, RuntimeResult<Vec<WValue>>>

Calls the wasm function.

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

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.

Implementors§