Wasmtime
types/arrayref.hh
Go to the documentation of this file.
1
5#ifndef WASMTIME_TYPES_ARRAYREF_HH
6#define WASMTIME_TYPES_ARRAYREF_HH
7
8#include <memory>
9#include <wasmtime/engine.hh>
12
13namespace wasmtime {
14
18class ArrayType {
20#define wasmtime_array_type_clone wasmtime_array_type_copy
21 WASMTIME_CLONE_WRAPPER(ArrayType, wasmtime_array_type)
22#undef wasmtime_array_type_clone
23
25 ArrayType(const Engine &engine, const FieldType &field)
26 : ArrayType(wasmtime_array_type_new(engine.capi(), field.capi())) {}
27
28 FieldType element_type() const {
30 wasmtime_array_type_element(capi(), &ty);
31 return FieldType(ty);
32 }
33};
34
35} // namespace wasmtime
36
37#endif // WASMTIME_TYPES_ARRAYREF_HH
Owned handle to a WebAssembly array type definition.
Definition: types/arrayref.hh:18
Describes the type and mutability of a struct field or array element.
Definition: types/structref.h:56
WASM_API_EXTERN wasmtime_array_type_t * wasmtime_array_type_new(const wasm_engine_t *engine, const wasmtime_field_type_t *field)
Create a new array type.
WASM_API_EXTERN void wasmtime_array_type_element(const wasmtime_array_type_t *ty, wasmtime_field_type_t *out)
Get the element type of an array type.