1#ifndef WASMTIME_TYPES_STRUCTREF_CLASS_HH
2#define WASMTIME_TYPES_STRUCTREF_CLASS_HH
6#ifdef WASMTIME_FEATURE_GC
11#include <wasmtime/types/_val_class.hh>
145#define wasmtime_struct_type_clone wasmtime_struct_type_copy
146 WASMTIME_CLONE_WRAPPER(
StructType, wasmtime_struct_type)
147#undef wasmtime_struct_type_clone
160 size_t num_fields()
const {
164 std::optional<FieldType> field(
size_t index)
const {
Global compilation state in Wasmtime.
Definition: engine.hh:22
Describes the storage type and mutability of a struct field or array element.
Definition: types/_structref_class.hh:80
static FieldType const_(const StorageType &ty)
Constructs an immutable field type with the given storage type.
Definition: types/_structref_class.hh:121
FieldType(bool is_mutable, const StorageType &ty)
Constructs a field type with the given mutability and storage type.
Definition: types/_structref_class.hh:112
static FieldType mut_(const StorageType &ty)
Constructs a mutable field type with the given storage type.
Definition: types/_structref_class.hh:118
bool is_mutable() const
Returns whether this field type is mutable.
Definition: types/_structref_class.hh:126
const wasmtime_field_type_t * capi() const
Returns the underlying C API field type.
Definition: types/_structref_class.hh:135
FieldType & operator=(FieldType &&other)
Move assignment operator.
Definition: types/_structref_class.hh:104
FieldType(wasmtime_field_type ty)
Constructs a field type from a C API field type.
Definition: types/_structref_class.hh:85
const StorageType & storage_type() const
Returns the storage type of this field type.
Definition: types/_structref_class.hh:129
FieldType(FieldType &&other)
Move constructor.
Definition: types/_structref_class.hh:99
FieldType & operator=(const FieldType &other)
Copy assignment operator.
Definition: types/_structref_class.hh:92
FieldType(const FieldType &other)
Copy constructor.
Definition: types/_structref_class.hh:88
Storage type for a struct field or array element.
Definition: types/_structref_class.hh:17
StorageType(const StorageType &other)
Copy constructor.
Definition: types/_structref_class.hh:24
const wasmtime_storage_type_t * capi() const
Returns the underlying C API storage type.
Definition: types/_structref_class.hh:59
StorageType & operator=(StorageType &&other)
Move assignment operator.
Definition: types/_structref_class.hh:40
static StorageType i16()
Constructs a storage type for a 16-bit integer.
Definition: types/_structref_class.hh:54
StorageType & operator=(const StorageType &other)
Copy assignment operator.
Definition: types/_structref_class.hh:28
bool is_i8() const
Returns whether this storage type is an 8-bit integer.
Definition: types/_structref_class.hh:62
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:69
StorageType(StorageType &&other)
Move constructor.
Definition: types/_structref_class.hh:35
bool is_i16() const
Returns whether this storage type is a 16-bit integer.
Definition: types/_structref_class.hh:65
static StorageType i8()
Constructs a storage type for an 8-bit integer.
Definition: types/_structref_class.hh:51
Owned handle to a WebAssembly struct type definition.
Definition: types/_structref_class.hh:144
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:56
bool mutable_
Definition: types/structref.h:59
wasmtime_storage_type_t storage
The type stored in this field.
Definition: types/structref.h:61
A storage type descriptor for struct/array fields.
Definition: types/structref.h:29
wasmtime_storage_type_kind_t kind
The kind of storage type this is.
Definition: types/structref.h:31
wasm_valtype_t * valtype
Definition: types/structref.h:34
#define WASMTIME_STORAGE_TYPE_KIND_I8
An 8-bit packed integer.
Definition: types/structref.h:22
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.
WASM_API_EXTERN wasmtime_struct_type_t * wasmtime_struct_type_new(const wasm_engine_t *engine, const wasmtime_field_type_t *fields, size_t nfields)
Create a new struct type.
#define WASMTIME_STORAGE_TYPE_KIND_I16
A 16-bit packed integer.
Definition: types/structref.h:24
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.
#define WASMTIME_STORAGE_TYPE_KIND_VALTYPE
A regular value type (i32, f64, funcref, etc).
Definition: types/structref.h:26
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:19