|
Wasmtime
|
Go to the source code of this file.
Typedefs | |
| typedef struct wasmtime_struct_ref_pre | wasmtime_struct_ref_pre_t |
| An opaque, pre-allocated, and registered struct layout for faster allocation. More... | |
Functions | |
| WASM_API_EXTERN wasmtime_struct_ref_pre_t * | wasmtime_struct_ref_pre_new (wasmtime_context_t *context, const wasmtime_struct_type_t *ty) |
| Create a new struct pre-allocator. More... | |
| WASM_API_EXTERN void | wasmtime_struct_ref_pre_delete (wasmtime_struct_ref_pre_t *pre) |
| Delete a struct pre-allocator. | |
| WASM_API_EXTERN wasmtime_error_t * | wasmtime_structref_new (wasmtime_context_t *context, const wasmtime_struct_ref_pre_t *pre, const wasmtime_val_t *fields, size_t nfields, wasmtime_structref_t *out) |
| Allocate a new struct instance. More... | |
| WASM_API_EXTERN void | wasmtime_structref_clone (const wasmtime_structref_t *structref, wasmtime_structref_t *out) |
Clone a structref, creating a new root. | |
| WASM_API_EXTERN void | wasmtime_structref_unroot (wasmtime_structref_t *ref) |
Unroot a structref to allow garbage collection. | |
| WASM_API_EXTERN void | wasmtime_structref_to_anyref (const wasmtime_structref_t *structref, wasmtime_anyref_t *out) |
Upcast a structref to an anyref. | |
| WASM_API_EXTERN void | wasmtime_structref_to_eqref (const wasmtime_structref_t *structref, wasmtime_eqref_t *out) |
Upcast a structref to an eqref. | |
| WASM_API_EXTERN wasmtime_error_t * | wasmtime_structref_field (wasmtime_context_t *context, const wasmtime_structref_t *structref, size_t index, wasmtime_val_t *out) |
| Read a field from a struct. More... | |
| WASM_API_EXTERN wasmtime_error_t * | wasmtime_structref_set_field (wasmtime_context_t *context, const wasmtime_structref_t *structref, size_t index, const wasmtime_val_t *val) |
| Set a field of a struct. More... | |
| WASM_API_EXTERN wasmtime_struct_type_t * | wasmtime_structref_type (wasmtime_context_t *context, const wasmtime_structref_t *structref) |
Returns the type of the specified structref. More... | |
APIs for interacting with WebAssembly structref type in Wasmtime.
| typedef struct wasmtime_struct_ref_pre wasmtime_struct_ref_pre_t |
An opaque, pre-allocated, and registered struct layout for faster allocation.
Created from a wasmtime_struct_type_t and a store context. Reusable for allocating many struct instances of the same type.
Owned. Must be deleted with wasmtime_struct_ref_pre_delete.
| WASM_API_EXTERN wasmtime_struct_ref_pre_t * wasmtime_struct_ref_pre_new | ( | wasmtime_context_t * | context, |
| const wasmtime_struct_type_t * | ty | ||
| ) |
Create a new struct pre-allocator.
| context | The store context. |
| ty | The struct type. |
| WASM_API_EXTERN wasmtime_error_t * wasmtime_structref_field | ( | wasmtime_context_t * | context, |
| const wasmtime_structref_t * | structref, | ||
| size_t | index, | ||
| wasmtime_val_t * | out | ||
| ) |
Read a field from a struct.
| context | The store context. |
| structref | The struct to read from (not consumed). |
| index | The field index. |
| out | Receives the field value on success. |
| WASM_API_EXTERN wasmtime_error_t * wasmtime_structref_new | ( | wasmtime_context_t * | context, |
| const wasmtime_struct_ref_pre_t * | pre, | ||
| const wasmtime_val_t * | fields, | ||
| size_t | nfields, | ||
| wasmtime_structref_t * | out | ||
| ) |
Allocate a new struct instance.
| context | The store context. |
| pre | The struct pre-allocator. |
| fields | Pointer to array of field values (wasmtime_val_t). |
| nfields | Number of fields (must match the struct type). |
| out | Receives the new structref on success. |
| WASM_API_EXTERN wasmtime_error_t * wasmtime_structref_set_field | ( | wasmtime_context_t * | context, |
| const wasmtime_structref_t * | structref, | ||
| size_t | index, | ||
| const wasmtime_val_t * | val | ||
| ) |
Set a field of a struct.
| context | The store context. |
| structref | The struct to write to (not consumed). |
| index | The field index. |
| val | The value to write (not consumed; caller must still unroot if applicable). |
| WASM_API_EXTERN wasmtime_struct_type_t * wasmtime_structref_type | ( | wasmtime_context_t * | context, |
| const wasmtime_structref_t * | structref | ||
| ) |
Returns the type of the specified structref.
structref is NULL or represents ref.null struct, then NULL is returned. Otherwise the type of this value is returned. Callers must delete the returned value.