Wasmtime
types/structref.h File Reference
#include <wasmtime/conf.h>
#include <wasm.h>

Go to the source code of this file.

Data Structures

struct  wasmtime_field_type
 Describes the type and mutability of a struct field or array element. More...
 

Macros

#define WASMTIME_STORAGE_KIND_I8   9
 An 8-bit packed integer (only valid inside struct/array fields).
 
#define WASMTIME_STORAGE_KIND_I16   10
 A 16-bit packed integer (only valid inside struct/array fields).
 

Typedefs

typedef uint8_t wasmtime_storage_kind_t
 Discriminant for storage types in struct/array field types. More...
 
typedef struct wasmtime_field_type wasmtime_field_type_t
 Convenience alias for wasmtime_field_type.
 
typedef struct wasmtime_struct_type wasmtime_struct_type_t
 An opaque handle to a WebAssembly struct type definition. More...
 

Functions

WASM_API_EXTERN wasmtime_struct_type_twasmtime_struct_type_new (const wasm_engine_t *engine, const wasmtime_field_type_t *fields, size_t nfields)
 Create a new struct type. More...
 
WASM_API_EXTERN void wasmtime_struct_type_delete (wasmtime_struct_type_t *ty)
 Delete a struct type.
 

Detailed Description

APIs for interacting with WebAssembly GC structref type in Wasmtime.

Typedef Documentation

◆ wasmtime_storage_kind_t

typedef uint8_t wasmtime_storage_kind_t

Discriminant for storage types in struct/array field types.

Extends wasmtime_valkind_t with packed storage types WASMTIME_STORAGE_KIND_I8 and WASMTIME_STORAGE_KIND_I16.

◆ wasmtime_struct_type_t

typedef struct wasmtime_struct_type wasmtime_struct_type_t

An opaque handle to a WebAssembly struct type definition.

A struct type describes the fields of a struct. It is used to create a wasmtime_struct_ref_pre_t, which can then allocate struct instances.

Owned. Must be deleted with wasmtime_struct_type_delete.

Function Documentation

◆ wasmtime_struct_type_new()

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.

Parameters
engineThe engine to register the type with.
fieldsPointer to an array of field type descriptors.
nfieldsNumber of fields.
Returns
Returns a new struct type, or NULL on error (e.g. invalid field types).