forked from open-policy-agent/opa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc-wasm.h
2069 lines (2037 loc) · 77.8 KB
/
doc-wasm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* \file wasm.h
*
* Upstream Embedding API for WebAssembly.
*
* This API is defined by the upstream wasm-c-api proposal at
* https://github.com/WebAssembly/wasm-c-api. That proposal is in flux but
* Wasmtime intends to be active in its development.
*
* The documentation for this header file is currently defined in the Wasmtime
* project, not in the upstream header file. Some behavior here may be
* Wasmtime-specific and may not be portable to other engines implementing the
* same C API. Also note that not all functionality from the upstream C API is
* implemented in Wasmtime. We strive to provide all symbols as to not generate
* link errors but some functions are unimplemented and will abort the process
* if called.
*
* ### Memory Management
*
* Memory management in the wasm C API is intended to be relatively simple. Each
* individual object is reference counted unless otherwise noted. You can delete
* any object at any time after you no longer need it. Deletion of an object
* does not imply that the memory will be deallocated at that time. If another
* object still internally references the original object then the memory will
* still be alive.
*
* For example you can delete a #wasm_engine_t after you create a #wasm_store_t
* with #wasm_store_new. The engine, however, is still referenced by the
* #wasm_store_t so it will not be deallocated. In essence by calling
* #wasm_engine_delete you're release your own strong reference on the
* #wasm_engine_t, but that's it.
*
* Additionally APIs like #wasm_memory_copy do not actually copy the underlying
* data. Instead they only increment the reference count and return a new
* object. You'll need to still call #wasm_memory_delete (or the corresponding
* `*_delete` function) for each copy of an object you acquire.
*
* ### Vectors
*
* This API provides a number of `wasm_*_vec_t` type definitions and functions
* to work with them. Each vector is defined by a pointer and a length.
* "Ownership" of a vector refers to the data pointer, not the memory holding
* the data pointer and the length. It is safe, for example to create a
* #wasm_name_t on the stack and pass it to #wasm_importtype_new. The memory
* pointed to by #wasm_name_t must be properly initialized, however, and cannot
* reside on the stack.
*/
/**
* \typedef byte_t
* \brief A type definition for a number that occupies a single byte of data.
*
* \typedef wasm_byte_t
* \brief A type definition for a number that occupies a single byte of data.
*
* \typedef float32_t
* \brief A type definition for a 32-bit float.
*
* \typedef float64_t
* \brief A type definition for a 64-bit float.
*
* \typedef wasm_name_t
* \brief Convenience for hinting that an argument only accepts utf-8 input.
*/
/**
* \typedef wasm_config_t
* \brief Convenience alias for #wasm_config_t
*
* \struct wasm_config_t
* \brief Global engine configuration
*
* This structure represents global configuration used when constructing a
* #wasm_engine_t. There are now functions to modify this from wasm.h but the
* wasmtime/config.h header provides a number of Wasmtime-specific functions to
* tweak configuration options.
*
* This object is created with #wasm_config_new.
*
* Configuration is safe to share between threads. Typically you'll create a
* config object and immediately pass it into #wasm_engine_new_with_config,
* however.
*
* For more information about configuration see the Rust documentation as well
* at
* https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Config.html.
*
* \fn wasm_config_t *wasm_config_new(void);
* \brief Creates a new empty configuration object.
*
* The object returned is owned by the caller and will need to be deleted with
* #wasm_config_delete. May return `NULL` if a configuration object could not be
* allocated.
*
* \fn void wasm_config_delete(wasm_config_t*);
* \brief Deletes a configuration object.
*/
/**
* \typedef wasm_engine_t
* \brief Convenience alias for #wasm_engine_t
*
* \struct wasm_engine_t
* \brief Compilation environment and configuration.
*
* An engine is typically global in a program and contains all the configuration
* necessary for compiling wasm code. From an engine you'll typically create a
* #wasmtime_store_t. Engines are created with #wasm_engine_new or
* #wasm_engine_new_with_config.
*
* An engine is safe to share between threads. Multiple stores can be created
* within the same engine with each store living on a separate thread. Typically
* you'll create one #wasm_engine_t for the lifetime of your program.
*
* Engines are reference counted internally so #wasm_engine_delete can be called
* at any time after a #wasmtime_store_t has been created from one.
*
* \fn wasm_engine_t *wasm_engine_new(void);
* \brief Creates a new engine with the default configuration.
*
* The object returned is owned by the caller and will need to be deleted with
* #wasm_engine_delete. This may return `NULL` if the engine could not be
* allocated.
*
* \fn wasm_engine_t *wasm_engine_new_with_config(wasm_config_t *);
* \brief Creates a new engine with the specified configuration.
*
* This function will take ownership of the configuration specified regardless
* of the outcome of this function. You do not need to call #wasm_config_delete
* on the argument. The object returned is owned by the caller and will need to
* be deleted with #wasm_engine_delete. This may return `NULL` if the engine
* could not be allocated.
*
* \fn void wasm_engine_delete(wasm_engine_t*);
* \brief Deletes an engine.
*/
/**
* \typedef wasm_store_t
* \brief Convenience alias for #wasm_store_t
*
* \struct wasm_store_t
* \brief A collection of instances and wasm global items.
*
* A #wasm_store_t corresponds to the concept of an [embedding
* store](https://webassembly.github.io/spec/core/exec/runtime.html#store)
*
* \fn wasm_store_t *wasm_store_new(wasm_engine_t *);
* \brief Creates a new store within the specified engine.
*
* The object returned is owned by the caller and will need to be deleted with
* #wasm_store_delete. This may return `NULL` if the store could not be
* allocated.
*
* \fn void wasm_store_delete(wasm_store_t *);
* \brief Deletes the specified store.
*/
/**
* \struct wasm_byte_vec_t
* \brief A list of bytes
*
* Used to pass data in or pass data out of various functions. The meaning and
* ownership of the bytes is defined by each API that operates on this
* datatype.
*
* \var wasm_byte_vec_t::size
* \brief Length of this vector.
*
* \var wasm_byte_vec_t::data
* \brief Pointer to the base of this vector
*
* \typedef wasm_byte_vec_t
* \brief Convenience alias for #wasm_byte_vec_t
*
* \typedef wasm_message_t
* \brief Alias of #wasm_byte_vec_t which always has a trailing 0-byte.
*
* \fn wasm_name
* \brief Unused by Wasmtime
*
* \fn wasm_name_new
* \brief Convenience alias
*
* \fn wasm_name_new_empty
* \brief Convenience alias
*
* \fn wasm_name_new_new_uninitialized
* \brief Convenience alias
*
* \fn wasm_name_new_from_string
* \brief Create a new name from a C string.
*
* \fn wasm_name_new_from_string_nt
* \brief Create a new name from a C string with null terminator.
*
* \fn wasm_name_copy
* \brief Convenience alias
*
* \fn wasm_name_delete
* \brief Convenience alias
*
* \fn void wasm_byte_vec_new_empty(wasm_byte_vec_t *out);
* \brief Initializes an empty byte vector.
*
* \fn void wasm_byte_vec_new_uninitialized(wasm_byte_vec_t *out, size_t);
* \brief Initializes an byte vector with the specified capacity.
*
* This function will initialize the provided vector with capacity to hold the
* specified number of bytes. The `out` parameter must previously not already be
* initialized and after this function is called you are then responsible for
* ensuring #wasm_byte_vec_delete is called.
*
* \fn void wasm_byte_vec_new(wasm_byte_vec_t *out, size_t, wasm_byte_t const[]);
* \brief Copies the specified data into a new byte vector.
*
* This function will copy the provided data into this byte vector. The byte
* vector should not be previously initialized and the caller is responsible for
* calling #wasm_byte_vec_delete after this function returns.
*
* Note that memory of the the initialization vector provided to this function
* must be managed externally. This function will copy the contents to the
* output vector, but it's up to the caller to properly deallocate the memory.
*
* \fn void wasm_byte_vec_copy(wasm_byte_vec_t *out, const wasm_byte_vec_t *);
* \brief Copies one vector into a new vector.
*
* Copies the second argument's data into the first argument. The `out` vector
* should not be previously initialized and after this function returns you're
* responsible for calling #wasm_byte_vec_delete.
*
* \fn void wasm_byte_vec_delete(wasm_byte_vec_t *);
* \brief Deletes a byte vector.
*
* This function will deallocate the data referenced by the argument provided.
* This does not deallocate the memory holding the #wasm_byte_vec_t itself, it's
* expected that memory is owned by the caller.
*/
/**
* \struct wasm_valtype_t
* \brief An object representing the type of a value.
*
* \typedef wasm_valtype_t
* \brief Convenience alias for #wasm_valtype_t
*
* \struct wasm_valtype_vec_t
* \brief A list of #wasm_valtype_t values.
*
* \var wasm_valtype_vec_t::size
* \brief Length of this vector.
*
* \var wasm_valtype_vec_t::data
* \brief Pointer to the base of this vector
*
* \typedef wasm_valtype_vec_t
* \brief Convenience alias for #wasm_valtype_vec_t
*
* \fn void wasm_valtype_delete(wasm_valtype_t *);
* \brief Deletes a type.
*
* \fn void wasm_valtype_vec_new_empty(wasm_valtype_vec_t *out);
* \brief Creates an empty vector.
*
* See #wasm_byte_vec_new_empty for more information.
*
* \fn void wasm_valtype_vec_new_uninitialized(wasm_valtype_vec_t *out, size_t);
* \brief Creates a vector with the given capacity.
*
* See #wasm_byte_vec_new_uninitialized for more information.
*
* \fn void wasm_valtype_vec_new(wasm_valtype_vec_t *out, size_t, wasm_valtype_t *const[]);
* \brief Creates a vector with the provided contents.
*
* See #wasm_byte_vec_new for more information.
*
* \fn void wasm_valtype_vec_copy(wasm_valtype_vec_t *out, const wasm_valtype_vec_t *)
* \brief Copies one vector to another
*
* See #wasm_byte_vec_copy for more information.
*
* \fn void wasm_valtype_vec_delete(wasm_valtype_vec_t *out)
* \brief Deallocates memory for a vector.
*
* See #wasm_byte_vec_delete for more information.
*
* \fn wasm_valtype_t* wasm_valtype_copy(const wasm_valtype_t *)
* \brief Creates a new value which matches the provided one.
*
* The caller is responsible for deleting the returned value.
*
* \fn wasm_valtype_t* wasm_valtype_new(wasm_valkind_t);
* \brief Creates a new value type from the specified kind.
*
* The caller is responsible for deleting the returned value.
*
* \fn wasm_valkind_t wasm_valtype_kind(const wasm_valtype_t *);
* \brief Returns the associated kind for this value type.
*/
/**
* \typedef wasm_valkind_t
* \brief Different kinds of types supported in wasm.
*/
/**
* \struct wasm_functype_t
* \brief An opaque object representing the type of a function.
*
* \typedef wasm_functype_t
* \brief Convenience alias for #wasm_functype_t
*
* \struct wasm_functype_vec_t
* \brief A list of #wasm_functype_t values.
*
* \var wasm_functype_vec_t::size
* \brief Length of this vector.
*
* \var wasm_functype_vec_t::data
* \brief Pointer to the base of this vector
*
* \typedef wasm_functype_vec_t
* \brief Convenience alias for #wasm_functype_vec_t
*
* \fn void wasm_functype_delete(wasm_functype_t *);
* \brief Deletes a type.
*
* \fn void wasm_functype_vec_new_empty(wasm_functype_vec_t *out);
* \brief Creates an empty vector.
*
* See #wasm_byte_vec_new_empty for more information.
*
* \fn void wasm_functype_vec_new_uninitialized(wasm_functype_vec_t *out, size_t);
* \brief Creates a vector with the given capacity.
*
* See #wasm_byte_vec_new_uninitialized for more information.
*
* \fn void wasm_functype_vec_new(wasm_functype_vec_t *out, size_t, wasm_functype_t *const[]);
* \brief Creates a vector with the provided contents.
*
* See #wasm_byte_vec_new for more information.
*
* \fn void wasm_functype_vec_copy(wasm_functype_vec_t *out, const wasm_functype_vec_t *)
* \brief Copies one vector to another
*
* See #wasm_byte_vec_copy for more information.
*
* \fn void wasm_functype_vec_delete(wasm_functype_vec_t *out)
* \brief Deallocates memory for a vector.
*
* See #wasm_byte_vec_delete for more information.
*
* \fn wasm_functype_t* wasm_functype_copy(const wasm_functype_t *)
* \brief Creates a new value which matches the provided one.
*
* The caller is responsible for deleting the returned value.
*
* \fn wasm_functype_t* wasm_functype_new(wasm_valtype_vec_t *params, wasm_valtype_vec_t *results);
* \brief Creates a new function type with the provided parameter and result
* types.
*
* This function takes ownership of the `params` and `results` arguments.
*
* The caller is responsible for deleting the returned value.
*
* \fn const wasm_valtype_vec_t* wasm_functype_params(const wasm_functype_t *);
* \brief Returns the list of parameters of this function type.
*
* The returned memory is owned by the #wasm_functype_t argument, the caller
* should not deallocate it.
*
* \fn const wasm_valtype_vec_t* wasm_functype_results(const wasm_functype_t *);
* \brief Returns the list of results of this function type.
*
* The returned memory is owned by the #wasm_functype_t argument, the caller
* should not deallocate it.
*/
/**
* \struct wasm_globaltype_t
* \brief An opaque object representing the type of a global.
*
* \typedef wasm_globaltype_t
* \brief Convenience alias for #wasm_globaltype_t
*
* \struct wasm_globaltype_vec_t
* \brief A list of #wasm_globaltype_t values.
*
* \var wasm_globaltype_vec_t::size
* \brief Length of this vector.
*
* \var wasm_globaltype_vec_t::data
* \brief Pointer to the base of this vector
*
* \typedef wasm_globaltype_vec_t
* \brief Convenience alias for #wasm_globaltype_vec_t
*
* \fn void wasm_globaltype_delete(wasm_globaltype_t *);
* \brief Deletes a type.
*
* \fn void wasm_globaltype_vec_new_empty(wasm_globaltype_vec_t *out);
* \brief Creates an empty vector.
*
* See #wasm_byte_vec_new_empty for more information.
*
* \fn void wasm_globaltype_vec_new_uninitialized(wasm_globaltype_vec_t *out, size_t);
* \brief Creates a vector with the given capacity.
*
* See #wasm_byte_vec_new_uninitialized for more information.
*
* \fn void wasm_globaltype_vec_new(wasm_globaltype_vec_t *out, size_t, wasm_globaltype_t *const[]);
* \brief Creates a vector with the provided contents.
*
* See #wasm_byte_vec_new for more information.
*
* \fn void wasm_globaltype_vec_copy(wasm_globaltype_vec_t *out, const wasm_globaltype_vec_t *)
* \brief Copies one vector to another
*
* See #wasm_byte_vec_copy for more information.
*
* \fn void wasm_globaltype_vec_delete(wasm_globaltype_vec_t *out)
* \brief Deallocates memory for a vector.
*
* See #wasm_byte_vec_delete for more information.
*
* \fn wasm_globaltype_t* wasm_globaltype_copy(const wasm_globaltype_t *)
* \brief Creates a new value which matches the provided one.
*
* The caller is responsible for deleting the returned value.
*
* \fn wasm_globaltype_t* wasm_globaltype_new(wasm_valtype_t *, wasm_mutability_t)
* \brief Creates a new global type.
*
* This function takes ownership of the #wasm_valtype_t argument.
*
* The caller is responsible for deleting the returned value.
*
* \fn const wasm_valtype_t* wasm_globaltype_content(const wasm_globaltype_t *);
* \brief Returns the type of value contained in a global.
*
* The returned memory is owned by the provided #wasm_globaltype_t, the caller
* should not deallocate it.
*
* \fn wasm_mutability_t wasm_globaltype_mutability(const wasm_globaltype_t *);
* \brief Returns whether or not a global is mutable.
*/
/**
* \typedef wasm_mutability_t
* \brief Boolean flag for whether a global is mutable or not.
*/
/**
* \struct wasm_tabletype_t
* \brief An opaque object representing the type of a table.
*
* \typedef wasm_tabletype_t
* \brief Convenience alias for #wasm_tabletype_t
*
* \struct wasm_tabletype_vec_t
* \brief A list of #wasm_tabletype_t values.
*
* \var wasm_tabletype_vec_t::size
* \brief Length of this vector.
*
* \var wasm_tabletype_vec_t::data
* \brief Pointer to the base of this vector
*
* \typedef wasm_tabletype_vec_t
* \brief Convenience alias for #wasm_tabletype_vec_t
*
* \fn void wasm_tabletype_delete(wasm_tabletype_t *);
* \brief Deletes a type.
*
* \fn void wasm_tabletype_vec_new_empty(wasm_tabletype_vec_t *out);
* \brief Creates an empty vector.
*
* See #wasm_byte_vec_new_empty for more information.
*
* \fn void wasm_tabletype_vec_new_uninitialized(wasm_tabletype_vec_t *out, size_t);
* \brief Creates a vector with the given capacity.
*
* See #wasm_byte_vec_new_uninitialized for more information.
*
* \fn void wasm_tabletype_vec_new(wasm_tabletype_vec_t *out, size_t, wasm_tabletype_t *const[]);
* \brief Creates a vector with the provided contents.
*
* See #wasm_byte_vec_new for more information.
*
* \fn void wasm_tabletype_vec_copy(wasm_tabletype_vec_t *out, const wasm_tabletype_vec_t *)
* \brief Copies one vector to another
*
* See #wasm_byte_vec_copy for more information.
*
* \fn void wasm_tabletype_vec_delete(wasm_tabletype_vec_t *out)
* \brief Deallocates memory for a vector.
*
* See #wasm_byte_vec_delete for more information.
*
* \fn wasm_tabletype_t* wasm_tabletype_copy(const wasm_tabletype_t *)
* \brief Creates a new value which matches the provided one.
*
* The caller is responsible for deleting the returned value.
*
* \fn wasm_tabletype_t* wasm_tabletype_new(wasm_valtype_t *, const wasm_limits_t *)h
* \brief Creates a new table type.
*
* This function takes ownership of the #wasm_valtype_t argument, but does not
* take ownership of the #wasm_limits_t.
*
* The caller is responsible for deallocating the returned type.
*
* \fn const wasm_valtype_t* wasm_tabletype_element(const wasm_tabletype_t *);
* \brief Returns the element type of this table.
*
* The returned #wasm_valtype_t is owned by the #wasm_tabletype_t parameter, the
* caller should not deallocate it.
*
* \fn const wasm_limits_t* wasm_tabletype_limits(const wasm_tabletype_t *);
* \brief Returns the limits of this table.
*
* The returned #wasm_limits_t is owned by the #wasm_tabletype_t parameter, the
* caller should not deallocate it.
*/
/**
* \struct wasm_limits_t
* \brief Limits for tables/memories in wasm modules
* \var wasm_limits_t::min
* The minimum value required.
* \var wasm_limits_t::max
* The maximum value required, or `wasm_limits_max_default` if no maximum is
* specified.
*
* \typedef wasm_limits_t
* \brief A convenience typedef to #wasm_limits_t
*/
/**
* \struct wasm_memorytype_t
* \brief An opaque object representing the type of a memory.
*
* \typedef wasm_memorytype_t
* \brief Convenience alias for #wasm_memorytype_t
*
* \struct wasm_memorytype_vec_t
* \brief A list of #wasm_memorytype_t values.
*
* \var wasm_memorytype_vec_t::size
* \brief Length of this vector.
*
* \var wasm_memorytype_vec_t::data
* \brief Pointer to the base of this vector
*
* \typedef wasm_memorytype_vec_t
* \brief Convenience alias for #wasm_memorytype_vec_t
*
* \fn void wasm_memorytype_delete(wasm_memorytype_t *);
* \brief Deletes a type.
*
* \fn void wasm_memorytype_vec_new_empty(wasm_memorytype_vec_t *out);
* \brief Creates an empty vector.
*
* See #wasm_byte_vec_new_empty for more information.
*
* \fn void wasm_memorytype_vec_new_uninitialized(wasm_memorytype_vec_t *out, size_t);
* \brief Creates a vector with the given capacity.
*
* See #wasm_byte_vec_new_uninitialized for more information.
*
* \fn void wasm_memorytype_vec_new(wasm_memorytype_vec_t *out, size_t, wasm_memorytype_t *const[]);
* \brief Creates a vector with the provided contents.
*
* See #wasm_byte_vec_new for more information.
*
* \fn void wasm_memorytype_vec_copy(wasm_memorytype_vec_t *out, const wasm_memorytype_vec_t *)
* \brief Copies one vector to another
*
* See #wasm_byte_vec_copy for more information.
*
* \fn void wasm_memorytype_vec_delete(wasm_memorytype_vec_t *out)
* \brief Deallocates memory for a vector.
*
* See #wasm_byte_vec_delete for more information.
*
* \fn wasm_memorytype_t* wasm_memorytype_copy(const wasm_memorytype_t *)
* \brief Creates a new value which matches the provided one.
*
* The caller is responsible for deleting the returned value.
*
* \fn wasm_memorytype_t* wasm_memorytype_new(const wasm_limits_t *)h
* \brief Creates a new memory type.
*
* This function takes ownership of the #wasm_valtype_t argument, but does not
* take ownership of the #wasm_limits_t.
*
* The caller is responsible for deallocating the returned type.
*
* For compatibility with memory64 it's recommended to use
* #wasmtime_memorytype_new instead.
*
* \fn const wasm_limits_t* wasm_memorytype_limits(const wasm_memorytype_t *);
* \brief Returns the limits of this memory.
*
* The returned #wasm_limits_t is owned by the #wasm_memorytype_t parameter, the
* caller should not deallocate it.
*
* For compatibility with memory64 it's recommended to use
* #wasmtime_memorytype_maximum or #wasmtime_memorytype_minimum instead.
*/
/**
* \struct wasm_externtype_t
* \brief An opaque object representing the type of a external value. Can be
* seen as a superclass of #wasm_functype_t, #wasm_tabletype_t,
* #wasm_globaltype_t, and #wasm_memorytype_t.
*
* \typedef wasm_externtype_t
* \brief Convenience alias for #wasm_externtype_t
*
* \struct wasm_externtype_vec_t
* \brief A list of #wasm_externtype_t values.
*
* \var wasm_externtype_vec_t::size
* \brief Length of this vector.
*
* \var wasm_externtype_vec_t::data
* \brief Pointer to the base of this vector
*
* \typedef wasm_externtype_vec_t
* \brief Convenience alias for #wasm_externtype_vec_t
*
* \fn void wasm_externtype_delete(wasm_externtype_t *);
* \brief Deletes a type.
*
* \fn void wasm_externtype_vec_new_empty(wasm_externtype_vec_t *out);
* \brief Creates an empty vector.
*
* See #wasm_byte_vec_new_empty for more information.
*
* \fn void wasm_externtype_vec_new_uninitialized(wasm_externtype_vec_t *out, size_t);
* \brief Creates a vector with the given capacity.
*
* See #wasm_byte_vec_new_uninitialized for more information.
*
* \fn void wasm_externtype_vec_new(wasm_externtype_vec_t *out, size_t, wasm_externtype_t *const[]);
* \brief Creates a vector with the provided contents.
*
* See #wasm_byte_vec_new for more information.
*
* \fn void wasm_externtype_vec_copy(wasm_externtype_vec_t *out, const wasm_externtype_vec_t *)
* \brief Copies one vector to another
*
* See #wasm_byte_vec_copy for more information.
*
* \fn void wasm_externtype_vec_delete(wasm_externtype_vec_t *out)
* \brief Deallocates extern for a vector.
*
* See #wasm_byte_vec_delete for more information.
*
* \fn wasm_externtype_t* wasm_externtype_copy(const wasm_externtype_t *)
* \brief Creates a new value which matches the provided one.
*
* The caller is responsible for deleting the returned value.
*
* \fn wasm_externkind_t wasm_externtype_kind(const wasm_externtype_t *)
* \brief Returns the kind of external item this type represents.
*/
/**
* \typedef wasm_externkind_t
* \brief Classifier for #wasm_externtype_t
*
* This is returned from #wasm_extern_kind and #wasm_externtype_kind to
* determine what kind of type is wrapped.
*/
/**
* \fn wasm_externtype_t* wasm_functype_as_externtype(wasm_functype_t *)
* \brief Converts a #wasm_functype_t to a #wasm_externtype_t
*
* The returned value is owned by the #wasm_functype_t argument and should not
* be deleted.
*
* \fn wasm_externtype_t* wasm_tabletype_as_externtype(wasm_tabletype_t *)
* \brief Converts a #wasm_tabletype_t to a #wasm_externtype_t
*
* The returned value is owned by the #wasm_tabletype_t argument and should not
* be deleted.
*
* \fn wasm_externtype_t* wasm_globaltype_as_externtype(wasm_globaltype_t *)
* \brief Converts a #wasm_globaltype_t to a #wasm_externtype_t
*
* The returned value is owned by the #wasm_globaltype_t argument and should not
* be deleted.
*
* \fn wasm_externtype_t* wasm_memorytype_as_externtype(wasm_memorytype_t *)
* \brief Converts a #wasm_memorytype_t to a #wasm_externtype_t
*
* The returned value is owned by the #wasm_memorytype_t argument and should not
* be deleted.
*
* \fn const wasm_externtype_t* wasm_functype_as_externtype_const(const wasm_functype_t *)
* \brief Converts a #wasm_functype_t to a #wasm_externtype_t
*
* The returned value is owned by the #wasm_functype_t argument and should not
* be deleted.
*
* \fn const wasm_externtype_t* wasm_tabletype_as_externtype_const(const wasm_tabletype_t *)
* \brief Converts a #wasm_tabletype_t to a #wasm_externtype_t
*
* The returned value is owned by the #wasm_tabletype_t argument and should not
* be deleted.
*
* \fn const wasm_externtype_t* wasm_globaltype_as_externtype_const(const wasm_globaltype_t *)
* \brief Converts a #wasm_globaltype_t to a #wasm_externtype_t
*
* The returned value is owned by the #wasm_globaltype_t argument and should not
* be deleted.
*
* \fn const wasm_externtype_t* wasm_memorytype_as_externtype_const(const wasm_memorytype_t *)
* \brief Converts a #wasm_memorytype_t to a #wasm_externtype_t
*
* The returned value is owned by the #wasm_memorytype_t argument and should not
* be deleted.
*
* \fn wasm_functype_t* wasm_externtype_as_functype(wasm_externtype_t *)
* \brief Attempts to convert a #wasm_externtype_t to a #wasm_functype_t
*
* The returned value is owned by the #wasm_functype_t argument and should not
* be deleted. Returns `NULL` if the provided argument is not a
* #wasm_functype_t.
*
* \fn wasm_tabletype_t* wasm_externtype_as_tabletype(wasm_externtype_t *)
* \brief Attempts to convert a #wasm_externtype_t to a #wasm_tabletype_t
*
* The returned value is owned by the #wasm_tabletype_t argument and should not
* be deleted. Returns `NULL` if the provided argument is not a
* #wasm_tabletype_t.
*
* \fn wasm_memorytype_t* wasm_externtype_as_memorytype(wasm_externtype_t *)
* \brief Attempts to convert a #wasm_externtype_t to a #wasm_memorytype_t
*
* The returned value is owned by the #wasm_memorytype_t argument and should not
* be deleted. Returns `NULL` if the provided argument is not a
* #wasm_memorytype_t.
*
* \fn wasm_globaltype_t* wasm_externtype_as_globaltype(wasm_externtype_t *)
* \brief Attempts to convert a #wasm_externtype_t to a #wasm_globaltype_t
*
* The returned value is owned by the #wasm_globaltype_t argument and should not
* be deleted. Returns `NULL` if the provided argument is not a
* #wasm_globaltype_t.
*
* \fn const wasm_functype_t* wasm_externtype_as_functype_const(const wasm_externtype_t *)
* \brief Attempts to convert a #wasm_externtype_t to a #wasm_functype_t
*
* The returned value is owned by the #wasm_functype_t argument and should not
* be deleted. Returns `NULL` if the provided argument is not a
* #wasm_functype_t.
*
* \fn const wasm_tabletype_t* wasm_externtype_as_tabletype_const(const wasm_externtype_t *)
* \brief Attempts to convert a #wasm_externtype_t to a #wasm_tabletype_t
*
* The returned value is owned by the #wasm_tabletype_t argument and should not
* be deleted. Returns `NULL` if the provided argument is not a
* #wasm_tabletype_t.
*
* \fn const wasm_memorytype_t* wasm_externtype_as_memorytype_const(const wasm_externtype_t *)
* \brief Attempts to convert a #wasm_externtype_t to a #wasm_memorytype_t
*
* The returned value is owned by the #wasm_memorytype_t argument and should not
* be deleted. Returns `NULL` if the provided argument is not a
* #wasm_memorytype_t.
*
* \fn const wasm_globaltype_t* wasm_externtype_as_globaltype_const(const wasm_externtype_t *)
* \brief Attempts to convert a #wasm_externtype_t to a #wasm_globaltype_t
*
* The returned value is owned by the #wasm_globaltype_t argument and should not
* be deleted. Returns `NULL` if the provided argument is not a
* #wasm_globaltype_t.
*/
/**
* \struct wasm_importtype_t
* \brief An opaque object representing the type of an import.
*
* \typedef wasm_importtype_t
* \brief Convenience alias for #wasm_importtype_t
*
* \struct wasm_importtype_vec_t
* \brief A list of #wasm_importtype_t values.
*
* \var wasm_importtype_vec_t::size
* \brief Length of this vector.
*
* \var wasm_importtype_vec_t::data
* \brief Pointer to the base of this vector
*
* \typedef wasm_importtype_vec_t
* \brief Convenience alias for #wasm_importtype_vec_t
*
* \fn void wasm_importtype_delete(wasm_importtype_t *);
* \brief Deletes a type.
*
* \fn void wasm_importtype_vec_new_empty(wasm_importtype_vec_t *out);
* \brief Creates an empty vector.
*
* See #wasm_byte_vec_new_empty for more information.
*
* \fn void wasm_importtype_vec_new_uninitialized(wasm_importtype_vec_t *out, size_t);
* \brief Creates a vector with the given capacity.
*
* See #wasm_byte_vec_new_uninitialized for more information.
*
* \fn void wasm_importtype_vec_new(wasm_importtype_vec_t *out, size_t, wasm_importtype_t *const[]);
* \brief Creates a vector with the provided contents.
*
* See #wasm_byte_vec_new for more information.
*
* \fn void wasm_importtype_vec_copy(wasm_importtype_vec_t *out, const wasm_importtype_vec_t *)
* \brief Copies one vector to another
*
* See #wasm_byte_vec_copy for more information.
*
* \fn void wasm_importtype_vec_delete(wasm_importtype_vec_t *out)
* \brief Deallocates import for a vector.
*
* See #wasm_byte_vec_delete for more information.
*
* \fn wasm_importtype_t* wasm_importtype_copy(const wasm_importtype_t *)
* \brief Creates a new value which matches the provided one.
*
* The caller is responsible for deleting the returned value.
*
* \fn wasm_importtype_t* wasm_importtype_new(wasm_name_t *module, wasm_name_t *name, wasm_externtype_t *)
* \brief Creates a new import type.
*
* This function takes ownership of the `module`, `name`, and
* #wasm_externtype_t arguments. The caller is responsible for deleting the
* returned value. Note that `name` can be `NULL` where in the module linking
* proposal the import name can be omitted.
*
* \fn const wasm_name_t* wasm_importtype_module(const wasm_importtype_t *);
* \brief Returns the module this import is importing from.
*
* The returned memory is owned by the #wasm_importtype_t argument, the caller
* should not deallocate it.
*
* \fn const wasm_name_t* wasm_importtype_name(const wasm_importtype_t *);
* \brief Returns the name this import is importing from.
*
* The returned memory is owned by the #wasm_importtype_t argument, the caller
* should not deallocate it. Note that `NULL` can be returned which means
* that the import name is not provided. This is for imports with the module
* linking proposal that only have the module specified.
*
* \fn const wasm_externtype_t* wasm_importtype_type(const wasm_importtype_t *);
* \brief Returns the type of item this import is importing.
*
* The returned memory is owned by the #wasm_importtype_t argument, the caller
* should not deallocate it.
*/
/**
* \struct wasm_exporttype_t
* \brief An opaque object representing the type of an export.
*
* \typedef wasm_exporttype_t
* \brief Convenience alias for #wasm_exporttype_t
*
* \struct wasm_exporttype_vec_t
* \brief A list of #wasm_exporttype_t values.
*
* \var wasm_exporttype_vec_t::size
* \brief Length of this vector.
*
* \var wasm_exporttype_vec_t::data
* \brief Pointer to the base of this vector
*
* \typedef wasm_exporttype_vec_t
* \brief Convenience alias for #wasm_exporttype_vec_t
*
* \fn void wasm_exporttype_delete(wasm_exporttype_t *);
* \brief Deletes a type.
*
* \fn void wasm_exporttype_vec_new_empty(wasm_exporttype_vec_t *out);
* \brief Creates an empty vector.
*
* See #wasm_byte_vec_new_empty for more information.
*
* \fn void wasm_exporttype_vec_new_uninitialized(wasm_exporttype_vec_t *out, size_t);
* \brief Creates a vector with the given capacity.
*
* See #wasm_byte_vec_new_uninitialized for more information.
*
* \fn void wasm_exporttype_vec_new(wasm_exporttype_vec_t *out, size_t, wasm_exporttype_t *const[]);
* \brief Creates a vector with the provided contents.
*
* See #wasm_byte_vec_new for more information.
*
* \fn void wasm_exporttype_vec_copy(wasm_exporttype_vec_t *out, const wasm_exporttype_vec_t *)
* \brief Copies one vector to another
*
* See #wasm_byte_vec_copy for more information.
*
* \fn void wasm_exporttype_vec_delete(wasm_exporttype_vec_t *out)
* \brief Deallocates export for a vector.
*
* See #wasm_byte_vec_delete for more information.
*
* \fn wasm_exporttype_t* wasm_exporttype_copy(const wasm_exporttype_t *)
* \brief Creates a new value which matches the provided one.
*
* The caller is responsible for deleting the returned value.
*
* \fn wasm_exporttype_t* wasm_exporttype_new(wasm_name_t *name, wasm_externtype_t *)
* \brief Creates a new export type.
*
* This function takes ownership of the `name` and
* #wasm_externtype_t arguments. The caller is responsible for deleting the
* returned value.
*
* \fn const wasm_name_t* wasm_exporttype_name(const wasm_exporttype_t *);
* \brief Returns the name of this export.
*
* The returned memory is owned by the #wasm_exporttype_t argument, the caller
* should not deallocate it.
*
* \fn const wasm_externtype_t* wasm_exporttype_type(const wasm_exporttype_t *);
* \brief Returns the type of this export.
*
* The returned memory is owned by the #wasm_exporttype_t argument, the caller
* should not deallocate it.
*/
/**
* \struct wasm_val_t
* \brief Representation of a WebAssembly value.
*
* Note that this structure is intended to represent the way to communicate
* values from the embedder to the engine. This type is not actually the
* internal representation in JIT code, for example.
*
* Also note that this is an owned value, notably the `ref` field. The
* #wasm_val_delete function does not delete the memory holding the #wasm_val_t
* itself, but only the memory pointed to by #wasm_val_t.
*
* \var wasm_val_t::kind
* \brief The kind of this value, or which of the fields in the `of` payload
* contains the actual value.
*
* \var wasm_val_t::of
* \brief The actual value of this #wasm_val_t. Only one field of this
* anonymous union is valid, and which field is valid is defined by the `kind`
* field.
*
* \var wasm_val_t::@0::i32
* \brief value for the `WASM_I32` type
*
* \var wasm_val_t::@0::i64
* \brief value for the `WASM_I64` type
*
* \var wasm_val_t::@0::f32
* \brief value for the `WASM_F32` type
*
* \var wasm_val_t::@0::f64
* \brief value for the `WASM_F64` type
*
* \var wasm_val_t::@0::ref
* \brief Unused by Wasmtime.
*
* \typedef wasm_val_t
* \brief Convenience alias for #wasm_val_t
*
* \struct wasm_val_vec_t
* \brief A list of #wasm_val_t values.
*
* \var wasm_val_vec_t::size
* \brief Length of this vector.
*
* \var wasm_val_vec_t::data
* \brief Pointer to the base of this vector
*
* \typedef wasm_val_vec_t
* \brief Convenience alias for #wasm_val_vec_t
*
* \fn void wasm_val_delete(wasm_val_t *v);
* \brief Deletes a type.
*
* This does not delete the memory pointed to by `v`, so it's safe for `v` to
* reside on the stack. Instead this only deletes the memory referenced by `v`,
* such as the `ref` variant of #wasm_val_t.
*
* \fn void wasm_val_vec_new_empty(wasm_val_vec_t *out);
* \brief Creates an empty vector.
*
* See #wasm_byte_vec_new_empty for more information.
*
* \fn void wasm_val_vec_new_uninitialized(wasm_val_vec_t *out, size_t);