Wasmtime
component/types/val.h
Go to the documentation of this file.
1
2
3#ifndef WASMTIME_COMPONENT_TYPES_VAL_H
4#define WASMTIME_COMPONENT_TYPES_VAL_H
5
6#include <wasmtime/conf.h>
7
8#ifdef WASMTIME_FEATURE_COMPONENT_MODEL
9
10#include <stdint.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
18
19// ----------- lists -----------------------------------------------------------
20
22typedef struct wasmtime_component_list_type wasmtime_component_list_type_t;
23
28WASM_API_EXTERN wasmtime_component_list_type_t *
30
32WASM_API_EXTERN bool
35
37WASM_API_EXTERN void
39
46 struct wasmtime_component_valtype_t *type_ret);
47
48// ----------- records ---------------------------------------------------------
49
51typedef struct wasmtime_component_record_type wasmtime_component_record_type_t;
52
60
62WASM_API_EXTERN bool
65
67WASM_API_EXTERN void
69
73
79 const wasmtime_component_record_type_t *ty, size_t nth,
80 const char **name_ret, size_t *name_len_ret,
81 struct wasmtime_component_valtype_t *type_ret);
82
83// ----------- tuples ---------------------------------------------------------
84
86typedef struct wasmtime_component_tuple_type wasmtime_component_tuple_type_t;
87
92WASM_API_EXTERN wasmtime_component_tuple_type_t *
94
96WASM_API_EXTERN bool
99
101WASM_API_EXTERN void
103
107
113 const wasmtime_component_tuple_type_t *ty, size_t nth,
114 struct wasmtime_component_valtype_t *type_ret);
115
116// ----------- variants --------------------------------------------------------
117
119typedef struct wasmtime_component_variant_type
121
126WASM_API_EXTERN wasmtime_component_variant_type_t *
129
134
136WASM_API_EXTERN void
138
142
147 const wasmtime_component_variant_type_t *ty, size_t nth,
148 const char **name_ret, size_t *name_len_ret, bool *has_payload_ret,
149 struct wasmtime_component_valtype_t *payload_ret);
150
151// ----------- enums -----------------------------------------------------------
152
154typedef struct wasmtime_component_enum_type wasmtime_component_enum_type_t;
155
160WASM_API_EXTERN wasmtime_component_enum_type_t *
162
164WASM_API_EXTERN bool
167
169WASM_API_EXTERN void
171
175
177WASM_API_EXTERN bool
179 size_t nth, const char **name_ret,
180 size_t *name_len_ret);
181
182// ----------- options ---------------------------------------------------------
183
185typedef struct wasmtime_component_option_type wasmtime_component_option_type_t;
186
191WASM_API_EXTERN wasmtime_component_option_type_t *
194
196WASM_API_EXTERN bool
199
201WASM_API_EXTERN void
203
210 struct wasmtime_component_valtype_t *type_ret);
211
212// ----------- results ---------------------------------------------------------
213
215typedef struct wasmtime_component_result_type wasmtime_component_result_type_t;
216
221WASM_API_EXTERN wasmtime_component_result_type_t *
224
226WASM_API_EXTERN bool
229
231WASM_API_EXTERN void
233
239 struct wasmtime_component_valtype_t *type_ret);
240
246 struct wasmtime_component_valtype_t *type_ret);
247
248// ----------- flags -----------------------------------------------------------
249
251typedef struct wasmtime_component_flags_type wasmtime_component_flags_type_t;
252
257WASM_API_EXTERN wasmtime_component_flags_type_t *
259
261WASM_API_EXTERN bool
264
266WASM_API_EXTERN void
268
272
275 const wasmtime_component_flags_type_t *ty, size_t nth,
276 const char **name_ret, size_t *name_len_ret);
277
278// ----------- futures ---------------------------------------------------------
279
281typedef struct wasmtime_component_future_type wasmtime_component_future_type_t;
282
287WASM_API_EXTERN wasmtime_component_future_type_t *
290
292WASM_API_EXTERN bool
295
297WASM_API_EXTERN void
299
306 struct wasmtime_component_valtype_t *type_ret);
307
308// ----------- streams ---------------------------------------------------------
309
311typedef struct wasmtime_component_stream_type wasmtime_component_stream_type_t;
312
317WASM_API_EXTERN wasmtime_component_stream_type_t *
320
322WASM_API_EXTERN bool
325
327WASM_API_EXTERN void
329
336 struct wasmtime_component_valtype_t *type_ret);
337
338// ----------- maps ------------------------------------------------------------
339
341typedef struct wasmtime_component_map_type wasmtime_component_map_type_t;
342
347WASM_API_EXTERN wasmtime_component_map_type_t *
349
351WASM_API_EXTERN bool
354
356WASM_API_EXTERN void
358
363WASM_API_EXTERN void
365 struct wasmtime_component_valtype_t *type_ret);
366
373 struct wasmtime_component_valtype_t *type_ret);
374
375// ----------- valtype ---------------------------------------------------------
376
379#define WASMTIME_COMPONENT_VALTYPE_BOOL 0
382#define WASMTIME_COMPONENT_VALTYPE_S8 1
385#define WASMTIME_COMPONENT_VALTYPE_S16 2
388#define WASMTIME_COMPONENT_VALTYPE_S32 3
391#define WASMTIME_COMPONENT_VALTYPE_S64 4
394#define WASMTIME_COMPONENT_VALTYPE_U8 5
397#define WASMTIME_COMPONENT_VALTYPE_U16 6
400#define WASMTIME_COMPONENT_VALTYPE_U32 7
403#define WASMTIME_COMPONENT_VALTYPE_U64 8
406#define WASMTIME_COMPONENT_VALTYPE_F32 9
409#define WASMTIME_COMPONENT_VALTYPE_F64 10
412#define WASMTIME_COMPONENT_VALTYPE_CHAR 11
415#define WASMTIME_COMPONENT_VALTYPE_STRING 12
418#define WASMTIME_COMPONENT_VALTYPE_LIST 13
421#define WASMTIME_COMPONENT_VALTYPE_RECORD 14
424#define WASMTIME_COMPONENT_VALTYPE_TUPLE 15
427#define WASMTIME_COMPONENT_VALTYPE_VARIANT 16
430#define WASMTIME_COMPONENT_VALTYPE_ENUM 17
433#define WASMTIME_COMPONENT_VALTYPE_OPTION 18
436#define WASMTIME_COMPONENT_VALTYPE_RESULT 19
439#define WASMTIME_COMPONENT_VALTYPE_FLAGS 20
442#define WASMTIME_COMPONENT_VALTYPE_OWN 21
445#define WASMTIME_COMPONENT_VALTYPE_BORROW 22
448#define WASMTIME_COMPONENT_VALTYPE_FUTURE 23
451#define WASMTIME_COMPONENT_VALTYPE_STREAM 24
454#define WASMTIME_COMPONENT_VALTYPE_ERROR_CONTEXT 25
457#define WASMTIME_COMPONENT_VALTYPE_MAP 26
458
461
504
512
517WASM_API_EXTERN void
520
522WASM_API_EXTERN bool
525
527WASM_API_EXTERN void
529
530#ifdef __cplusplus
531}
532#endif
533
534#endif // WASMTIME_FEATURE_COMPONENT_MODEL
535
536#endif // WASMTIME_COMPONENT_TYPES_VAL_H
WASM_API_EXTERN wasmtime_component_enum_type_t * wasmtime_component_enum_type_clone(const wasmtime_component_enum_type_t *ty)
Clones a component enum type.
WASM_API_EXTERN void wasmtime_component_tuple_type_delete(wasmtime_component_tuple_type_t *ptr)
Deallocates a component tuple type.
WASM_API_EXTERN bool wasmtime_component_result_type_err(const wasmtime_component_result_type_t *ty, struct wasmtime_component_valtype_t *type_ret)
Returns the err type of a component result type. The returned type must be deallocated with wasmtime_...
WASM_API_EXTERN void wasmtime_component_option_type_ty(const wasmtime_component_option_type_t *ty, struct wasmtime_component_valtype_t *type_ret)
Returns the inner type of a component option type.
struct wasmtime_component_map_type wasmtime_component_map_type_t
Opaque type representing a component map type.
Definition: component/types/val.h:341
WASM_API_EXTERN wasmtime_component_result_type_t * wasmtime_component_result_type_clone(const wasmtime_component_result_type_t *ty)
Clones a component result type.
WASM_API_EXTERN size_t wasmtime_component_tuple_type_types_count(const wasmtime_component_tuple_type_t *ty)
Returns the number of types in a component tuple type.
WASM_API_EXTERN size_t wasmtime_component_enum_type_names_count(const wasmtime_component_enum_type_t *ty)
Returns the number of names in a component enum type.
WASM_API_EXTERN bool wasmtime_component_tuple_type_types_nth(const wasmtime_component_tuple_type_t *ty, size_t nth, struct wasmtime_component_valtype_t *type_ret)
Returns the nth type in a component tuple type.
WASM_API_EXTERN wasmtime_component_list_type_t * wasmtime_component_list_type_clone(const wasmtime_component_list_type_t *ty)
Clones a component list type.
WASM_API_EXTERN wasmtime_component_option_type_t * wasmtime_component_option_type_clone(const wasmtime_component_option_type_t *ty)
Clones a component option type.
WASM_API_EXTERN bool wasmtime_component_future_type_equal(const wasmtime_component_future_type_t *a, const wasmtime_component_future_type_t *b)
Compares two component future types for equality.
WASM_API_EXTERN size_t wasmtime_component_flags_type_names_count(const wasmtime_component_flags_type_t *ty)
Returns the number of names in a component flags type.
WASM_API_EXTERN bool wasmtime_component_variant_type_equal(const wasmtime_component_variant_type_t *a, const wasmtime_component_variant_type_t *b)
Compares two component variant types for equality.
struct wasmtime_component_flags_type wasmtime_component_flags_type_t
Opaque type representing a component flags type.
Definition: component/types/val.h:251
WASM_API_EXTERN size_t wasmtime_component_variant_type_case_count(const wasmtime_component_variant_type_t *ty)
Returns the number of cases in a component variant type.
WASM_API_EXTERN bool wasmtime_component_stream_type_ty(const wasmtime_component_stream_type_t *ty, struct wasmtime_component_valtype_t *type_ret)
Returns the inner type of a component stream type.
struct wasmtime_component_future_type wasmtime_component_future_type_t
Opaque type representing a component future type.
Definition: component/types/val.h:281
WASM_API_EXTERN void wasmtime_component_valtype_clone(const wasmtime_component_valtype_t *ty, wasmtime_component_valtype_t *out)
Clones a component value type.
struct wasmtime_component_record_type wasmtime_component_record_type_t
Opaque type representing a component record type.
Definition: component/types/val.h:51
struct wasmtime_component_stream_type wasmtime_component_stream_type_t
Opaque type representing a component stream type.
Definition: component/types/val.h:311
WASM_API_EXTERN bool wasmtime_component_record_type_field_nth(const wasmtime_component_record_type_t *ty, size_t nth, const char **name_ret, size_t *name_len_ret, struct wasmtime_component_valtype_t *type_ret)
Returns the nth field in a component record type.
WASM_API_EXTERN bool wasmtime_component_tuple_type_equal(const wasmtime_component_tuple_type_t *a, const wasmtime_component_tuple_type_t *b)
Compares two component tuple types for equality.
WASM_API_EXTERN bool wasmtime_component_stream_type_equal(const wasmtime_component_stream_type_t *a, const wasmtime_component_stream_type_t *b)
Compares two component stream types for equality.
WASM_API_EXTERN wasmtime_component_future_type_t * wasmtime_component_future_type_clone(const wasmtime_component_future_type_t *ty)
Clones a component future type.
WASM_API_EXTERN void wasmtime_component_list_type_delete(wasmtime_component_list_type_t *ptr)
Deallocates a component list type.
WASM_API_EXTERN void wasmtime_component_enum_type_delete(wasmtime_component_enum_type_t *ptr)
Deallocates a component enum type.
WASM_API_EXTERN wasmtime_component_tuple_type_t * wasmtime_component_tuple_type_clone(const wasmtime_component_tuple_type_t *ty)
Clones a component tuple type.
struct wasmtime_component_tuple_type wasmtime_component_tuple_type_t
Opaque type representing a component tuple type.
Definition: component/types/val.h:86
WASM_API_EXTERN void wasmtime_component_variant_type_delete(wasmtime_component_variant_type_t *ptr)
Deallocates a component variant type.
WASM_API_EXTERN bool wasmtime_component_result_type_ok(const wasmtime_component_result_type_t *ty, struct wasmtime_component_valtype_t *type_ret)
Returns the ok type of a component result type. The returned type must be deallocated with wasmtime_c...
WASM_API_EXTERN wasmtime_component_record_type_t * wasmtime_component_record_type_clone(const wasmtime_component_record_type_t *ty)
Clones a component record type.
struct wasmtime_component_enum_type wasmtime_component_enum_type_t
Opaque type representing a component enum type.
Definition: component/types/val.h:154
WASM_API_EXTERN bool wasmtime_component_variant_type_case_nth(const wasmtime_component_variant_type_t *ty, size_t nth, const char **name_ret, size_t *name_len_ret, bool *has_payload_ret, struct wasmtime_component_valtype_t *payload_ret)
Returns the nth case in a component variant type. The returned payload type must be deallocated with ...
WASM_API_EXTERN bool wasmtime_component_record_type_equal(const wasmtime_component_record_type_t *a, const wasmtime_component_record_type_t *b)
Compares two component record types for equality.
WASM_API_EXTERN bool wasmtime_component_flags_type_equal(const wasmtime_component_flags_type_t *a, const wasmtime_component_flags_type_t *b)
Compares two component flags types for equality.
WASM_API_EXTERN void wasmtime_component_map_type_value(const wasmtime_component_map_type_t *ty, struct wasmtime_component_valtype_t *type_ret)
Returns the value type of a component map type.
WASM_API_EXTERN bool wasmtime_component_enum_type_equal(const wasmtime_component_enum_type_t *a, const wasmtime_component_enum_type_t *b)
Compares two component enum types for equality.
struct wasmtime_component_option_type wasmtime_component_option_type_t
Opaque type representing a component option type.
Definition: component/types/val.h:185
WASM_API_EXTERN void wasmtime_component_valtype_delete(wasmtime_component_valtype_t *ptr)
Deallocates a component value type.
WASM_API_EXTERN void wasmtime_component_option_type_delete(wasmtime_component_option_type_t *ptr)
Deallocates a component option type.
WASM_API_EXTERN bool wasmtime_component_future_type_ty(const wasmtime_component_future_type_t *ty, struct wasmtime_component_valtype_t *type_ret)
Returns the inner type of a component future type.
union wasmtime_component_valtype_union wasmtime_component_valtype_union_t
Represents a single value type in the component model.
WASM_API_EXTERN wasmtime_component_map_type_t * wasmtime_component_map_type_clone(const wasmtime_component_map_type_t *ty)
Clones a component map type.
WASM_API_EXTERN bool wasmtime_component_flags_type_names_nth(const wasmtime_component_flags_type_t *ty, size_t nth, const char **name_ret, size_t *name_len_ret)
Returns the nth name in a component flags type.
WASM_API_EXTERN bool wasmtime_component_enum_type_names_nth(const wasmtime_component_enum_type_t *ty, size_t nth, const char **name_ret, size_t *name_len_ret)
Returns the nth name in a component enum type.
WASM_API_EXTERN void wasmtime_component_map_type_delete(wasmtime_component_map_type_t *ptr)
Deallocates a component map type.
WASM_API_EXTERN size_t wasmtime_component_record_type_field_count(const wasmtime_component_record_type_t *ty)
Returns the number of fields in a component record type.
WASM_API_EXTERN bool wasmtime_component_list_type_equal(const wasmtime_component_list_type_t *a, const wasmtime_component_list_type_t *b)
Compares two component list types for equality.
WASM_API_EXTERN wasmtime_component_stream_type_t * wasmtime_component_stream_type_clone(const wasmtime_component_stream_type_t *ty)
Clones a component stream type.
struct wasmtime_component_variant_type wasmtime_component_variant_type_t
Opaque type representing a component variant type.
Definition: component/types/val.h:119
WASM_API_EXTERN void wasmtime_component_map_type_key(const wasmtime_component_map_type_t *ty, struct wasmtime_component_valtype_t *type_ret)
Returns the key type of a component map type.
WASM_API_EXTERN void wasmtime_component_result_type_delete(wasmtime_component_result_type_t *ptr)
Deallocates a component result type.
struct wasmtime_component_valtype_t wasmtime_component_valtype_t
Represents a single value type in the component model.
uint8_t wasmtime_component_valtype_kind_t
Discriminant used in wasmtime_component_valtype_t::kind.
Definition: component/types/val.h:460
struct wasmtime_component_result_type wasmtime_component_result_type_t
Opaque type representing a component result type.
Definition: component/types/val.h:215
struct wasmtime_component_list_type wasmtime_component_list_type_t
Opaque type representing a component list type.
Definition: component/types/val.h:22
WASM_API_EXTERN bool wasmtime_component_valtype_equal(const wasmtime_component_valtype_t *a, const wasmtime_component_valtype_t *b)
Compares two component value types for equality.
WASM_API_EXTERN void wasmtime_component_future_type_delete(wasmtime_component_future_type_t *ptr)
Deallocates a component future type.
WASM_API_EXTERN void wasmtime_component_stream_type_delete(wasmtime_component_stream_type_t *ptr)
Deallocates a component stream type.
WASM_API_EXTERN void wasmtime_component_list_type_element(const wasmtime_component_list_type_t *ty, struct wasmtime_component_valtype_t *type_ret)
Returns the element type of a component list type.
WASM_API_EXTERN bool wasmtime_component_option_type_equal(const wasmtime_component_option_type_t *a, const wasmtime_component_option_type_t *b)
Compares two component option types for equality.
WASM_API_EXTERN wasmtime_component_variant_type_t * wasmtime_component_variant_type_clone(const wasmtime_component_variant_type_t *ty)
Clones a component variant type.
WASM_API_EXTERN bool wasmtime_component_result_type_equal(const wasmtime_component_result_type_t *a, const wasmtime_component_result_type_t *b)
Compares two component result types for equality.
WASM_API_EXTERN void wasmtime_component_record_type_delete(wasmtime_component_record_type_t *ptr)
Deallocates a component record type.
WASM_API_EXTERN bool wasmtime_component_map_type_equal(const wasmtime_component_map_type_t *a, const wasmtime_component_map_type_t *b)
Compares two component map types for equality.
WASM_API_EXTERN wasmtime_component_flags_type_t * wasmtime_component_flags_type_clone(const wasmtime_component_flags_type_t *ty)
Clones a component flags type.
WASM_API_EXTERN void wasmtime_component_flags_type_delete(wasmtime_component_flags_type_t *ptr)
Deallocates a component flags type.
Build-time defines for how the C API was built.
struct wasmtime_component_resource_type wasmtime_component_resource_type_t
Represents the type of a component resource.
Definition: resource.h:21
Represents a single value type in the component model.
Definition: component/types/val.h:506
wasmtime_component_valtype_union_t of
The actual type.
Definition: component/types/val.h:510
wasmtime_component_valtype_kind_t kind
The type discriminant for the of union.
Definition: component/types/val.h:508
Represents a single value type in the component model.
Definition: component/types/val.h:463
wasmtime_component_flags_type_t * flags
Definition: component/types/val.h:487
wasmtime_component_option_type_t * option
Definition: component/types/val.h:481
wasmtime_component_record_type_t * record
Definition: component/types/val.h:469
wasmtime_component_resource_type_t * borrow
Definition: component/types/val.h:493
wasmtime_component_list_type_t * list
Definition: component/types/val.h:466
wasmtime_component_tuple_type_t * tuple
Definition: component/types/val.h:472
wasmtime_component_future_type_t * future
Definition: component/types/val.h:496
wasmtime_component_result_type_t * result
Definition: component/types/val.h:484
wasmtime_component_map_type_t * map
Definition: component/types/val.h:502
wasmtime_component_enum_type_t * enum_
Definition: component/types/val.h:478
wasmtime_component_stream_type_t * stream
Definition: component/types/val.h:499
wasmtime_component_variant_type_t * variant
Definition: component/types/val.h:475