Wasmtime
anyref.h
Go to the documentation of this file.
1
7#ifndef WASMTIME_ANYREF_H
8#define WASMTIME_ANYREF_H
9
10#ifdef WASMTIME_FEATURE_GC
11
12#include <wasmtime/val.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
20static inline void wasmtime_anyref_set_null(wasmtime_anyref_t *ref) {
21 ref->store_id = 0;
22}
23
29static inline bool wasmtime_anyref_is_null(const wasmtime_anyref_t *ref) {
30 return ref->store_id == 0;
31}
32
40WASM_API_EXTERN void wasmtime_anyref_clone(const wasmtime_anyref_t *anyref,
42
56WASM_API_EXTERN void wasmtime_anyref_unroot(wasmtime_anyref_t *ref);
57
65WASM_API_EXTERN void wasmtime_anyref_from_raw(wasmtime_context_t *context,
66 uint32_t raw,
68
79WASM_API_EXTERN uint32_t wasmtime_anyref_to_raw(wasmtime_context_t *context,
80 const wasmtime_anyref_t *ref);
81
90WASM_API_EXTERN void wasmtime_anyref_from_i31(wasmtime_context_t *context,
91 uint32_t i31val,
93
100WASM_API_EXTERN bool wasmtime_anyref_is_i31(wasmtime_context_t *context,
101 const wasmtime_anyref_t *anyref);
102
112WASM_API_EXTERN bool wasmtime_anyref_i31_get_u(wasmtime_context_t *context,
113 const wasmtime_anyref_t *anyref,
114 uint32_t *dst);
115
125WASM_API_EXTERN bool wasmtime_anyref_i31_get_s(wasmtime_context_t *context,
126 const wasmtime_anyref_t *anyref,
127 int32_t *dst);
128
134WASM_API_EXTERN bool wasmtime_anyref_is_eqref(wasmtime_context_t *context,
135 const wasmtime_anyref_t *anyref);
136
143WASM_API_EXTERN bool wasmtime_anyref_as_eqref(wasmtime_context_t *context,
144 const wasmtime_anyref_t *anyref,
145 wasmtime_eqref_t *out);
146
152WASM_API_EXTERN bool wasmtime_anyref_is_struct(wasmtime_context_t *context,
153 const wasmtime_anyref_t *anyref);
154
161WASM_API_EXTERN bool wasmtime_anyref_as_struct(wasmtime_context_t *context,
162 const wasmtime_anyref_t *anyref,
164
170WASM_API_EXTERN bool wasmtime_anyref_is_array(wasmtime_context_t *context,
171 const wasmtime_anyref_t *anyref);
172
179WASM_API_EXTERN bool wasmtime_anyref_as_array(wasmtime_context_t *context,
180 const wasmtime_anyref_t *anyref,
182
183#ifdef __cplusplus
184} // extern "C"
185#endif
186
187#endif // WASMTIME_FEATURE_GC
188
189#endif // WASMTIME_ANYREF_H
A WebAssembly value in the any hierarchy of GC types.
Definition: val.h:77
uint64_t store_id
Definition: val.h:80
A WebAssembly arrayref value.
Definition: val.h:210
An interior pointer into a wasmtime_store_t which is used as "context" for many functions.
A WebAssembly eqref value.
Definition: val.h:163
A WebAssembly structref value.
Definition: val.h:187