5#ifndef WASMTIME_TYPES_FUNC_HH
6#define WASMTIME_TYPES_FUNC_HH
23 std::unique_ptr<wasm_functype_t, deleter> ptr;
51 FuncType(std::initializer_list<ValType> params,
52 std::initializer_list<ValType> results)
74 template <
typename P,
typename R>
82 for (
auto val : params) {
83 param_vec.
data[i++] = val.ptr.release();
86 for (
auto val : results) {
87 result_vec.
data[i++] = val.ptr.release();
Ref(const wasm_functype_t *ptr)
Creates a new reference from the underlying C API representation.
Definition: func.hh:34
ValType::ListRef results() const
Returns the list of types this function type returns.
Definition: func.hh:42
Ref(const FuncType &ty)
Creates a new reference to the given type.
Definition: func.hh:36
ValType::ListRef params() const
Returns the list of types this function type takes as parameters.
Definition: func.hh:39
Type information for a WebAssembly function.
Definition: func.hh:15
static FuncType from_iters(P params, R results)
Creates a new function type from the given list of parameters and results.
Definition: func.hh:75
FuncType(const FuncType &other)
Copies another type's information into this one.
Definition: func.hh:60
Ref * operator->()
Returns the underlying Ref, a non-owning reference pointing to this instance.
Definition: func.hh:95
Ref * operator*()
Returns the underlying Ref, a non-owning reference pointing to this instance.
Definition: func.hh:98
FuncType & operator=(const FuncType &other)
Copies another type's information into this one.
Definition: func.hh:63
FuncType(Ref other)
Copies a reference into a uniquely owned function type.
Definition: func.hh:58
FuncType(FuncType &&other)=default
Moves type information from another type into this one.
FuncType(std::initializer_list< ValType > params, std::initializer_list< ValType > results)
Creates a new function type from the given list of parameters and results.
Definition: func.hh:51
FuncType & operator=(FuncType &&other)=default
Moves type information from another type into this one.
Representation of a WebAssembly function.
Definition: wasmtime.hh:347
Helper class for linking modules together with name-based resolution.
Definition: wasmtime.hh:1061
Non-owning reference to a list of ValType instances. Must not be used after the original owner is del...
Definition: types/val.hh:116
An opaque object representing the type of a function.
A list of wasm_valtype_t values.
Definition: wasm.h:183
wasm_valtype_t ** data
Pointer to the base of this vector.
Definition: wasm.h:183
size_t size
Length of this vector.
Definition: wasm.h:183
wasm_functype_t * wasm_functype_copy(const wasm_functype_t *)
Creates a new value which matches the provided one.
void wasm_functype_delete(wasm_functype_t *)
Deletes a type.
const wasm_valtype_vec_t * wasm_functype_results(const wasm_functype_t *)
Returns the list of results of this function type.
const wasm_valtype_vec_t * wasm_functype_params(const wasm_functype_t *)
Returns the list of parameters of this function type.
wasm_functype_t * wasm_functype_new(wasm_valtype_vec_t *params, wasm_valtype_vec_t *results)
Creates a new function type with the provided parameter and result types.
void wasm_valtype_vec_new_uninitialized(wasm_valtype_vec_t *out, size_t)
Creates a vector with the given capacity.