Class: Wasmtime::FuncType

Inherits:
Object
  • Object
show all
Defined in:
ext/src/ruby_api/func.rs

Overview

Represents a WebAssembly Function Type

Instance Method Summary collapse

Instance Method Details

#paramsArray<Symbol>

Returns The function’s parameter types.

Returns:

  • (Array<Symbol>)

    The function’s parameter types.



42
43
44
45
46
47
48
49
# File 'ext/src/ruby_api/func.rs', line 42

pub fn params(&self) -> Result<RArray, Error> {
    let len = self.inner.params().len();
    let mut params = self.inner.params();
    params.try_fold(RArray::with_capacity(len), |array, p| {
        array.push(p.to_sym()?)?;
        Ok(array)
    })
}

#resultsArray<Symbol>

Returns The function’s result types.

Returns:

  • (Array<Symbol>)

    The function’s result types.



53
54
55
56
57
58
59
60
61
# File 'ext/src/ruby_api/func.rs', line 53

pub fn results(&self) -> Result<RArray, Error> {
        let len = self.inner.results().len();
        let mut results = self.inner.results();
        results.try_fold(RArray::with_capacity(len), |array, r| {
            array.push(r.to_sym()?)?;
            Ok(array)
        })
    }
}