Trait wasm_wave::wasm::WasmFunc

source ·
pub trait WasmFunc {
    type Type: WasmType;

    // Required methods
    fn params(&self) -> Box<dyn Iterator<Item = Self::Type> + '_>;
    fn results(&self) -> Box<dyn Iterator<Item = Self::Type> + '_>;

    // Provided methods
    fn param_names(&self) -> Box<dyn Iterator<Item = Cow<'_, str>> + '_> { ... }
    fn result_names(&self) -> Box<dyn Iterator<Item = Cow<'_, str>> + '_> { ... }
}
Expand description

The WasmFunc trait may be implemented to represent Wasm func type signatures to be (de)serialized with WAVE.

Required Associated Types§

source

type Type: WasmType

A type representing types of these params and results.

Required Methods§

source

fn params(&self) -> Box<dyn Iterator<Item = Self::Type> + '_>

Returns an iterator of the func’s parameter types.

source

fn results(&self) -> Box<dyn Iterator<Item = Self::Type> + '_>

Returns an iterator of the func’s result types.

Provided Methods§

source

fn param_names(&self) -> Box<dyn Iterator<Item = Cow<'_, str>> + '_>

Returns an iterator of the func’s parameter names. Must be the same length as the iterator returned by params or empty if this WasmFunc impl does not support param names.

source

fn result_names(&self) -> Box<dyn Iterator<Item = Cow<'_, str>> + '_>

Returns an iterator of the func’s result names. Must be the same length as the iterator returned by results or empty if there are no named results or if this WasmFunc impl does not support result names.

Implementations on Foreign Types§

source§

impl WasmFunc for ComponentFunc

§

type Type = Type

source§

fn params(&self) -> Box<dyn Iterator<Item = Self::Type> + '_>

source§

fn results(&self) -> Box<dyn Iterator<Item = Self::Type> + '_>

source§

impl WasmFunc for FuncType

§

type Type = ValType

source§

fn params(&self) -> Box<dyn Iterator<Item = Self::Type> + '_>

source§

fn results(&self) -> Box<dyn Iterator<Item = Self::Type> + '_>

Implementors§

source§

impl WasmFunc for wasm_wave::value::FuncType

§

type Type = Type

source§

impl WasmFunc for wasm_wave::wasmtime::FuncType

§

type Type = Type