1#ifndef WASMTIME_TYPES_STRUCTREF_CLASS_HH
2#define WASMTIME_TYPES_STRUCTREF_CLASS_HH
6#ifdef WASMTIME_FEATURE_GC
12#include <wasmtime/types/_val_class.hh>
142#define wasmtime_struct_type_clone wasmtime_struct_type_copy
143 WASMTIME_CLONE_WRAPPER(
StructType, wasmtime_struct_type)
144#undef wasmtime_struct_type_clone
148 const std::vector<FieldType> &fields) {
154 fields.size(), &result);
160 size_t num_fields()
const {
164 std::optional<FieldType> field(
size_t index)
const {
Global compilation state in Wasmtime.
Definition: engine.hh:23
Errors coming from Wasmtime.
Definition: error.hh:26
Describes the storage type and mutability of a struct field or array element.
Definition: types/_structref_class.hh:79
static FieldType const_(const StorageType &ty)
Constructs an immutable field type with the given storage type.
Definition: types/_structref_class.hh:118
FieldType(bool is_mutable, const StorageType &ty)
Constructs a field type with the given mutability and storage type.
Definition: types/_structref_class.hh:109
static FieldType mut_(const StorageType &ty)
Constructs a mutable field type with the given storage type.
Definition: types/_structref_class.hh:115
bool is_mutable() const
Returns whether this field type is mutable.
Definition: types/_structref_class.hh:123
const wasmtime_field_type_t * capi() const
Returns the underlying C API field type.
Definition: types/_structref_class.hh:132
FieldType & operator=(FieldType &&other)
Move assignment operator.
Definition: types/_structref_class.hh:101
FieldType(wasmtime_field_type ty)
Constructs a field type from a C API field type.
Definition: types/_structref_class.hh:84
const StorageType & storage_type() const
Returns the storage type of this field type.
Definition: types/_structref_class.hh:126
FieldType(FieldType &&other)
Move constructor.
Definition: types/_structref_class.hh:96
FieldType & operator=(const FieldType &other)
Copy assignment operator.
Definition: types/_structref_class.hh:91
FieldType(const FieldType &other)
Copy constructor.
Definition: types/_structref_class.hh:87
Fallible result type used for Wasmtime.
Definition: error.hh:70
Storage type for a struct field or array element.
Definition: types/_structref_class.hh:18
StorageType(const StorageType &other)
Copy constructor.
Definition: types/_structref_class.hh:25
const wasmtime_storage_type_t * capi() const
Returns the underlying C API storage type.
Definition: types/_structref_class.hh:58
StorageType & operator=(StorageType &&other)
Move assignment operator.
Definition: types/_structref_class.hh:39
static StorageType i16()
Constructs a storage type for a 16-bit integer.
Definition: types/_structref_class.hh:53
StorageType & operator=(const StorageType &other)
Copy assignment operator.
Definition: types/_structref_class.hh:29
bool is_i8() const
Returns whether this storage type is an 8-bit integer.
Definition: types/_structref_class.hh:61
std::optional< ValType::Ref > as_valtype() const
If this storage type is a value type, returns the underlying value type.
Definition: types/_structref_class.hh:68
StorageType(StorageType &&other)
Move constructor.
Definition: types/_structref_class.hh:34
bool is_i16() const
Returns whether this storage type is a 16-bit integer.
Definition: types/_structref_class.hh:64
static StorageType i8()
Constructs a storage type for an 8-bit integer.
Definition: types/_structref_class.hh:50
Owned handle to a WebAssembly struct type definition.
Definition: types/_structref_class.hh:141
Type information about a WebAssembly value.
Definition: types/_val_class.hh:19
Build-time defines for how the C API was built.
Describes the type and mutability of a struct field or array element.
Definition: types/structref.h:57
bool mutable_
Definition: types/structref.h:60
wasmtime_storage_type_t storage
The type stored in this field.
Definition: types/structref.h:62
A storage type descriptor for struct/array fields.
Definition: types/structref.h:30
wasmtime_storage_type_kind_t kind
The kind of storage type this is.
Definition: types/structref.h:32
wasm_valtype_t * valtype
Definition: types/structref.h:35
#define WASMTIME_STORAGE_TYPE_KIND_I8
An 8-bit packed integer.
Definition: types/structref.h:23
WASM_API_EXTERN bool wasmtime_struct_type_field(const wasmtime_struct_type_t *ty, size_t index, wasmtime_field_type_t *out)
Get the field type of a struct type's field by index.
struct wasmtime_struct_type wasmtime_struct_type_t
An opaque handle to a WebAssembly struct type definition.
Definition: types/structref.h:81
#define WASMTIME_STORAGE_TYPE_KIND_I16
A 16-bit packed integer.
Definition: types/structref.h:25
WASM_API_EXTERN void wasmtime_storage_type_clone(const wasmtime_storage_type_t *storage, wasmtime_storage_type_t *out)
Clone a storage type into out.
WASM_API_EXTERN void wasmtime_storage_type_delete(wasmtime_storage_type_t *storage)
Delete a storage type.
WASM_API_EXTERN wasmtime_error_t * wasmtime_struct_type_new(const wasm_engine_t *engine, const wasmtime_field_type_t *fields, size_t nfields, wasmtime_struct_type_t **out)
Create a new struct type.
#define WASMTIME_STORAGE_TYPE_KIND_VALTYPE
A regular value type (i32, f64, funcref, etc).
Definition: types/structref.h:27
WASM_API_EXTERN void wasmtime_field_type_clone(const wasmtime_field_type_t *field, wasmtime_field_type_t *out)
Clone a field type into out.
WASM_API_EXTERN void wasmtime_field_type_delete(wasmtime_field_type_t *field)
Delete a field type.
WASM_API_EXTERN size_t wasmtime_struct_type_num_fields(const wasmtime_struct_type_t *ty)
Get the number of fields in a struct type.
uint8_t wasmtime_storage_type_kind_t
Discriminant for storage types in struct/array field types.
Definition: types/structref.h:20