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/types/val.h>
13#include <wasmtime/val.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
21static inline void wasmtime_anyref_set_null(wasmtime_anyref_t *ref) {
22 ref->store_id = 0;
23}
24
30static inline bool wasmtime_anyref_is_null(const wasmtime_anyref_t *ref) {
31 return ref->store_id == 0;
32}
33
41WASM_API_EXTERN void wasmtime_anyref_clone(const wasmtime_anyref_t *anyref,
43
57WASM_API_EXTERN void wasmtime_anyref_unroot(wasmtime_anyref_t *ref);
58
66WASM_API_EXTERN void wasmtime_anyref_from_raw(wasmtime_context_t *context,
67 uint32_t raw,
69
80WASM_API_EXTERN uint32_t wasmtime_anyref_to_raw(wasmtime_context_t *context,
81 const wasmtime_anyref_t *ref);
82
91WASM_API_EXTERN void wasmtime_anyref_from_i31(wasmtime_context_t *context,
92 uint32_t i31val,
94
101WASM_API_EXTERN bool wasmtime_anyref_is_i31(wasmtime_context_t *context,
102 const wasmtime_anyref_t *anyref);
103
113WASM_API_EXTERN bool wasmtime_anyref_i31_get_u(wasmtime_context_t *context,
114 const wasmtime_anyref_t *anyref,
115 uint32_t *dst);
116
126WASM_API_EXTERN bool wasmtime_anyref_i31_get_s(wasmtime_context_t *context,
127 const wasmtime_anyref_t *anyref,
128 int32_t *dst);
129
135WASM_API_EXTERN bool wasmtime_anyref_is_eqref(wasmtime_context_t *context,
136 const wasmtime_anyref_t *anyref);
137
144WASM_API_EXTERN bool wasmtime_anyref_as_eqref(wasmtime_context_t *context,
145 const wasmtime_anyref_t *anyref,
146 wasmtime_eqref_t *out);
147
153WASM_API_EXTERN bool wasmtime_anyref_is_struct(wasmtime_context_t *context,
154 const wasmtime_anyref_t *anyref);
155
162WASM_API_EXTERN bool wasmtime_anyref_as_struct(wasmtime_context_t *context,
163 const wasmtime_anyref_t *anyref,
165
171WASM_API_EXTERN bool wasmtime_anyref_is_array(wasmtime_context_t *context,
172 const wasmtime_anyref_t *anyref);
173
180WASM_API_EXTERN bool wasmtime_anyref_as_array(wasmtime_context_t *context,
181 const wasmtime_anyref_t *anyref,
183
191WASM_API_EXTERN bool wasmtime_anyref_type(wasmtime_context_t *context,
192 const wasmtime_anyref_t *anyref,
194
195#ifdef __cplusplus
196} // extern "C"
197#endif
198
199#endif // WASMTIME_FEATURE_GC
200
201#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 heap type.
Definition: types/val.h:76
A WebAssembly structref value.
Definition: val.h:187