-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpdf.h
1287 lines (1088 loc) · 58.6 KB
/
pdf.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
// Generated by `wit-bindgen` 0.26.0. DO NOT EDIT!
#ifndef __BINDINGS_PDF_H
#define __BINDINGS_PDF_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdbool.h>
typedef struct pdf_string_t {
uint8_t*ptr;
size_t len;
} pdf_string_t;
// A log level, describing a kind of message.
typedef uint8_t wasi_logging_logging_level_t;
// Describes messages about the values of variables and the flow of
// control within a program.
#define WASI_LOGGING_LOGGING_LEVEL_TRACE 0
// Describes messages likely to be of interest to someone debugging a
// program.
#define WASI_LOGGING_LOGGING_LEVEL_DEBUG 1
// Describes messages likely to be of interest to someone monitoring a
// program.
#define WASI_LOGGING_LOGGING_LEVEL_INFO 2
// Describes messages indicating hazardous situations.
#define WASI_LOGGING_LOGGING_LEVEL_WARN 3
// Describes messages indicating serious errors.
#define WASI_LOGGING_LOGGING_LEVEL_ERROR 4
// Describes messages indicating fatal errors.
#define WASI_LOGGING_LOGGING_LEVEL_CRITICAL 5
typedef struct wasi_io_poll_own_pollable_t {
int32_t __handle;
} wasi_io_poll_own_pollable_t;
typedef struct wasi_io_poll_borrow_pollable_t {
int32_t __handle;
} wasi_io_poll_borrow_pollable_t;
typedef struct {
wasi_io_poll_borrow_pollable_t *ptr;
size_t len;
} wasi_io_poll_list_borrow_pollable_t;
typedef struct {
uint32_t *ptr;
size_t len;
} pdf_list_u32_t;
// An instant in time, in nanoseconds. An instant is relative to an
// unspecified initial value, and can only be compared to instances from
// the same monotonic-clock.
typedef uint64_t wasi_clocks_monotonic_clock_instant_t;
// A duration of time, in nanoseconds.
typedef uint64_t wasi_clocks_monotonic_clock_duration_t;
typedef wasi_io_poll_own_pollable_t wasi_clocks_monotonic_clock_own_pollable_t;
typedef struct wasi_io_error_own_error_t {
int32_t __handle;
} wasi_io_error_own_error_t;
typedef struct wasi_io_error_borrow_error_t {
int32_t __handle;
} wasi_io_error_borrow_error_t;
typedef wasi_io_error_own_error_t wasi_io_streams_own_error_t;
// An error for input-stream and output-stream operations.
typedef struct wasi_io_streams_stream_error_t {
uint8_t tag;
union {
wasi_io_streams_own_error_t last_operation_failed;
} val;
} wasi_io_streams_stream_error_t;
// The last operation (a write or flush) failed before completion.
//
// More information is available in the `error` payload.
#define WASI_IO_STREAMS_STREAM_ERROR_LAST_OPERATION_FAILED 0
// The stream is closed: no more input will be accepted by the
// stream. A closed output-stream will return this error on all
// future operations.
#define WASI_IO_STREAMS_STREAM_ERROR_CLOSED 1
typedef struct wasi_io_streams_own_input_stream_t {
int32_t __handle;
} wasi_io_streams_own_input_stream_t;
typedef struct wasi_io_streams_borrow_input_stream_t {
int32_t __handle;
} wasi_io_streams_borrow_input_stream_t;
typedef struct wasi_io_streams_own_output_stream_t {
int32_t __handle;
} wasi_io_streams_own_output_stream_t;
typedef struct wasi_io_streams_borrow_output_stream_t {
int32_t __handle;
} wasi_io_streams_borrow_output_stream_t;
typedef struct {
uint8_t *ptr;
size_t len;
} pdf_list_u8_t;
typedef struct {
bool is_err;
union {
pdf_list_u8_t ok;
wasi_io_streams_stream_error_t err;
} val;
} wasi_io_streams_result_list_u8_stream_error_t;
typedef struct {
bool is_err;
union {
uint64_t ok;
wasi_io_streams_stream_error_t err;
} val;
} wasi_io_streams_result_u64_stream_error_t;
typedef wasi_io_poll_own_pollable_t wasi_io_streams_own_pollable_t;
typedef struct {
bool is_err;
union {
wasi_io_streams_stream_error_t err;
} val;
} wasi_io_streams_result_void_stream_error_t;
typedef wasi_clocks_monotonic_clock_duration_t wasi_http_types_duration_t;
// This type corresponds to HTTP standard Methods.
typedef struct wasi_http_types_method_t {
uint8_t tag;
union {
pdf_string_t other;
} val;
} wasi_http_types_method_t;
#define WASI_HTTP_TYPES_METHOD_GET 0
#define WASI_HTTP_TYPES_METHOD_HEAD 1
#define WASI_HTTP_TYPES_METHOD_POST 2
#define WASI_HTTP_TYPES_METHOD_PUT 3
#define WASI_HTTP_TYPES_METHOD_DELETE 4
#define WASI_HTTP_TYPES_METHOD_CONNECT 5
#define WASI_HTTP_TYPES_METHOD_OPTIONS 6
#define WASI_HTTP_TYPES_METHOD_TRACE 7
#define WASI_HTTP_TYPES_METHOD_PATCH 8
#define WASI_HTTP_TYPES_METHOD_OTHER 9
// This type corresponds to HTTP standard Related Schemes.
typedef struct wasi_http_types_scheme_t {
uint8_t tag;
union {
pdf_string_t other;
} val;
} wasi_http_types_scheme_t;
#define WASI_HTTP_TYPES_SCHEME_HTTP 0
#define WASI_HTTP_TYPES_SCHEME_HTTPS 1
#define WASI_HTTP_TYPES_SCHEME_OTHER 2
typedef struct {
bool is_some;
pdf_string_t val;
} pdf_option_string_t;
typedef struct {
bool is_some;
uint16_t val;
} pdf_option_u16_t;
// Defines the case payload type for `DNS-error` above:
typedef struct wasi_http_types_dns_error_payload_t {
pdf_option_string_t rcode;
pdf_option_u16_t info_code;
} wasi_http_types_dns_error_payload_t;
typedef struct {
bool is_some;
uint8_t val;
} pdf_option_u8_t;
// Defines the case payload type for `TLS-alert-received` above:
typedef struct wasi_http_types_tls_alert_received_payload_t {
pdf_option_u8_t alert_id;
pdf_option_string_t alert_message;
} wasi_http_types_tls_alert_received_payload_t;
typedef struct {
bool is_some;
uint32_t val;
} pdf_option_u32_t;
// Defines the case payload type for `HTTP-response-{header,trailer}-size` above:
typedef struct wasi_http_types_field_size_payload_t {
pdf_option_string_t field_name;
pdf_option_u32_t field_size;
} wasi_http_types_field_size_payload_t;
typedef struct {
bool is_some;
uint64_t val;
} pdf_option_u64_t;
typedef struct {
bool is_some;
wasi_http_types_field_size_payload_t val;
} wasi_http_types_option_field_size_payload_t;
// These cases are inspired by the IANA HTTP Proxy Error Types:
// https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types
typedef struct wasi_http_types_error_code_t {
uint8_t tag;
union {
wasi_http_types_dns_error_payload_t dns_error;
wasi_http_types_tls_alert_received_payload_t tls_alert_received;
pdf_option_u64_t http_request_body_size;
pdf_option_u32_t http_request_header_section_size;
wasi_http_types_option_field_size_payload_t http_request_header_size;
pdf_option_u32_t http_request_trailer_section_size;
wasi_http_types_field_size_payload_t http_request_trailer_size;
pdf_option_u32_t http_response_header_section_size;
wasi_http_types_field_size_payload_t http_response_header_size;
pdf_option_u64_t http_response_body_size;
pdf_option_u32_t http_response_trailer_section_size;
wasi_http_types_field_size_payload_t http_response_trailer_size;
pdf_option_string_t http_response_transfer_coding;
pdf_option_string_t http_response_content_coding;
pdf_option_string_t internal_error;
} val;
} wasi_http_types_error_code_t;
#define WASI_HTTP_TYPES_ERROR_CODE_DNS_TIMEOUT 0
#define WASI_HTTP_TYPES_ERROR_CODE_DNS_ERROR 1
#define WASI_HTTP_TYPES_ERROR_CODE_DESTINATION_NOT_FOUND 2
#define WASI_HTTP_TYPES_ERROR_CODE_DESTINATION_UNAVAILABLE 3
#define WASI_HTTP_TYPES_ERROR_CODE_DESTINATION_IP_PROHIBITED 4
#define WASI_HTTP_TYPES_ERROR_CODE_DESTINATION_IP_UNROUTABLE 5
#define WASI_HTTP_TYPES_ERROR_CODE_CONNECTION_REFUSED 6
#define WASI_HTTP_TYPES_ERROR_CODE_CONNECTION_TERMINATED 7
#define WASI_HTTP_TYPES_ERROR_CODE_CONNECTION_TIMEOUT 8
#define WASI_HTTP_TYPES_ERROR_CODE_CONNECTION_READ_TIMEOUT 9
#define WASI_HTTP_TYPES_ERROR_CODE_CONNECTION_WRITE_TIMEOUT 10
#define WASI_HTTP_TYPES_ERROR_CODE_CONNECTION_LIMIT_REACHED 11
#define WASI_HTTP_TYPES_ERROR_CODE_TLS_PROTOCOL_ERROR 12
#define WASI_HTTP_TYPES_ERROR_CODE_TLS_CERTIFICATE_ERROR 13
#define WASI_HTTP_TYPES_ERROR_CODE_TLS_ALERT_RECEIVED 14
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_DENIED 15
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_LENGTH_REQUIRED 16
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_BODY_SIZE 17
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_METHOD_INVALID 18
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_URI_INVALID 19
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_URI_TOO_LONG 20
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_HEADER_SECTION_SIZE 21
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_HEADER_SIZE 22
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_TRAILER_SECTION_SIZE 23
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_TRAILER_SIZE 24
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_RESPONSE_INCOMPLETE 25
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_RESPONSE_HEADER_SECTION_SIZE 26
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_RESPONSE_HEADER_SIZE 27
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_RESPONSE_BODY_SIZE 28
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_RESPONSE_TRAILER_SECTION_SIZE 29
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_RESPONSE_TRAILER_SIZE 30
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_RESPONSE_TRANSFER_CODING 31
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_RESPONSE_CONTENT_CODING 32
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_RESPONSE_TIMEOUT 33
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_UPGRADE_FAILED 34
#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_PROTOCOL_ERROR 35
#define WASI_HTTP_TYPES_ERROR_CODE_LOOP_DETECTED 36
#define WASI_HTTP_TYPES_ERROR_CODE_CONFIGURATION_ERROR 37
// This is a catch-all error for anything that doesn't fit cleanly into a
// more specific case. It also includes an optional string for an
// unstructured description of the error. Users should not depend on the
// string for diagnosing errors, as it's not required to be consistent
// between implementations.
#define WASI_HTTP_TYPES_ERROR_CODE_INTERNAL_ERROR 38
// This type enumerates the different kinds of errors that may occur when
// setting or appending to a `fields` resource.
typedef struct wasi_http_types_header_error_t {
uint8_t tag;
} wasi_http_types_header_error_t;
// This error indicates that a `field-key` or `field-value` was
// syntactically invalid when used with an operation that sets headers in a
// `fields`.
#define WASI_HTTP_TYPES_HEADER_ERROR_INVALID_SYNTAX 0
// This error indicates that a forbidden `field-key` was used when trying
// to set a header in a `fields`.
#define WASI_HTTP_TYPES_HEADER_ERROR_FORBIDDEN 1
// This error indicates that the operation on the `fields` was not
// permitted because the fields are immutable.
#define WASI_HTTP_TYPES_HEADER_ERROR_IMMUTABLE 2
// Field keys are always strings.
typedef pdf_string_t wasi_http_types_field_key_t;
// Field values should always be ASCII strings. However, in
// reality, HTTP implementations often have to interpret malformed values,
// so they are provided as a list of bytes.
typedef struct wasi_http_types_field_value_t {
uint8_t *ptr;
size_t len;
} wasi_http_types_field_value_t;
typedef struct wasi_http_types_own_fields_t {
int32_t __handle;
} wasi_http_types_own_fields_t;
typedef struct wasi_http_types_borrow_fields_t {
int32_t __handle;
} wasi_http_types_borrow_fields_t;
typedef struct wasi_http_types_own_incoming_request_t {
int32_t __handle;
} wasi_http_types_own_incoming_request_t;
typedef struct wasi_http_types_borrow_incoming_request_t {
int32_t __handle;
} wasi_http_types_borrow_incoming_request_t;
typedef struct wasi_http_types_own_outgoing_request_t {
int32_t __handle;
} wasi_http_types_own_outgoing_request_t;
typedef struct wasi_http_types_borrow_outgoing_request_t {
int32_t __handle;
} wasi_http_types_borrow_outgoing_request_t;
typedef struct wasi_http_types_own_request_options_t {
int32_t __handle;
} wasi_http_types_own_request_options_t;
typedef struct wasi_http_types_borrow_request_options_t {
int32_t __handle;
} wasi_http_types_borrow_request_options_t;
typedef struct wasi_http_types_own_response_outparam_t {
int32_t __handle;
} wasi_http_types_own_response_outparam_t;
typedef struct wasi_http_types_borrow_response_outparam_t {
int32_t __handle;
} wasi_http_types_borrow_response_outparam_t;
// This type corresponds to the HTTP standard Status Code.
typedef uint16_t wasi_http_types_status_code_t;
typedef struct wasi_http_types_own_incoming_response_t {
int32_t __handle;
} wasi_http_types_own_incoming_response_t;
typedef struct wasi_http_types_borrow_incoming_response_t {
int32_t __handle;
} wasi_http_types_borrow_incoming_response_t;
typedef struct wasi_http_types_own_incoming_body_t {
int32_t __handle;
} wasi_http_types_own_incoming_body_t;
typedef struct wasi_http_types_borrow_incoming_body_t {
int32_t __handle;
} wasi_http_types_borrow_incoming_body_t;
typedef struct wasi_http_types_own_future_trailers_t {
int32_t __handle;
} wasi_http_types_own_future_trailers_t;
typedef struct wasi_http_types_borrow_future_trailers_t {
int32_t __handle;
} wasi_http_types_borrow_future_trailers_t;
typedef struct wasi_http_types_own_outgoing_response_t {
int32_t __handle;
} wasi_http_types_own_outgoing_response_t;
typedef struct wasi_http_types_borrow_outgoing_response_t {
int32_t __handle;
} wasi_http_types_borrow_outgoing_response_t;
typedef struct wasi_http_types_own_outgoing_body_t {
int32_t __handle;
} wasi_http_types_own_outgoing_body_t;
typedef struct wasi_http_types_borrow_outgoing_body_t {
int32_t __handle;
} wasi_http_types_borrow_outgoing_body_t;
typedef struct wasi_http_types_own_future_incoming_response_t {
int32_t __handle;
} wasi_http_types_own_future_incoming_response_t;
typedef struct wasi_http_types_borrow_future_incoming_response_t {
int32_t __handle;
} wasi_http_types_borrow_future_incoming_response_t;
typedef wasi_io_error_borrow_error_t wasi_http_types_borrow_io_error_t;
typedef struct {
bool is_some;
wasi_http_types_error_code_t val;
} wasi_http_types_option_error_code_t;
typedef struct {
wasi_http_types_field_key_t f0;
wasi_http_types_field_value_t f1;
} pdf_tuple2_field_key_field_value_t;
typedef struct {
pdf_tuple2_field_key_field_value_t *ptr;
size_t len;
} pdf_list_tuple2_field_key_field_value_t;
typedef struct {
bool is_err;
union {
wasi_http_types_own_fields_t ok;
wasi_http_types_header_error_t err;
} val;
} wasi_http_types_result_own_fields_header_error_t;
typedef struct {
wasi_http_types_field_value_t *ptr;
size_t len;
} pdf_list_field_value_t;
typedef struct {
bool is_err;
union {
wasi_http_types_header_error_t err;
} val;
} wasi_http_types_result_void_header_error_t;
typedef struct {
bool is_some;
wasi_http_types_scheme_t val;
} wasi_http_types_option_scheme_t;
typedef wasi_http_types_own_fields_t wasi_http_types_own_headers_t;
typedef struct {
bool is_err;
union {
wasi_http_types_own_incoming_body_t ok;
} val;
} wasi_http_types_result_own_incoming_body_void_t;
typedef struct {
bool is_err;
union {
wasi_http_types_own_outgoing_body_t ok;
} val;
} wasi_http_types_result_own_outgoing_body_void_t;
typedef struct {
bool is_err;
} wasi_http_types_result_void_void_t;
typedef struct {
bool is_some;
wasi_http_types_duration_t val;
} pdf_option_duration_t;
typedef struct {
bool is_err;
union {
wasi_http_types_own_outgoing_response_t ok;
wasi_http_types_error_code_t err;
} val;
} wasi_http_types_result_own_outgoing_response_error_code_t;
typedef wasi_io_streams_own_input_stream_t wasi_http_types_own_input_stream_t;
typedef struct {
bool is_err;
union {
wasi_http_types_own_input_stream_t ok;
} val;
} wasi_http_types_result_own_input_stream_void_t;
typedef wasi_io_poll_own_pollable_t wasi_http_types_own_pollable_t;
typedef wasi_http_types_own_fields_t wasi_http_types_own_trailers_t;
typedef struct {
bool is_some;
wasi_http_types_own_trailers_t val;
} wasi_http_types_option_own_trailers_t;
typedef struct {
bool is_err;
union {
wasi_http_types_option_own_trailers_t ok;
wasi_http_types_error_code_t err;
} val;
} wasi_http_types_result_option_own_trailers_error_code_t;
typedef struct {
bool is_err;
union {
wasi_http_types_result_option_own_trailers_error_code_t ok;
} val;
} wasi_http_types_result_result_option_own_trailers_error_code_void_t;
typedef struct {
bool is_some;
wasi_http_types_result_result_option_own_trailers_error_code_void_t val;
} wasi_http_types_option_result_result_option_own_trailers_error_code_void_t;
typedef wasi_io_streams_own_output_stream_t wasi_http_types_own_output_stream_t;
typedef struct {
bool is_err;
union {
wasi_http_types_own_output_stream_t ok;
} val;
} wasi_http_types_result_own_output_stream_void_t;
typedef struct {
bool is_err;
union {
wasi_http_types_error_code_t err;
} val;
} wasi_http_types_result_void_error_code_t;
typedef struct {
bool is_err;
union {
wasi_http_types_own_incoming_response_t ok;
wasi_http_types_error_code_t err;
} val;
} wasi_http_types_result_own_incoming_response_error_code_t;
typedef struct {
bool is_err;
union {
wasi_http_types_result_own_incoming_response_error_code_t ok;
} val;
} wasi_http_types_result_result_own_incoming_response_error_code_void_t;
typedef struct {
bool is_some;
wasi_http_types_result_result_own_incoming_response_error_code_void_t val;
} wasi_http_types_option_result_result_own_incoming_response_error_code_void_t;
typedef wasi_http_types_own_incoming_request_t exports_wasi_http_incoming_handler_own_incoming_request_t;
typedef wasi_http_types_own_response_outparam_t exports_wasi_http_incoming_handler_own_response_outparam_t;
// Imported Functions from `wasi:logging/logging`
// Emit a log message.
//
// A log message has a `level` describing what kind of message is being
// sent, a context, which is an uninterpreted string meant to help
// consumers group similar messages, and a string containing the message
// text.
extern void wasi_logging_logging_log(wasi_logging_logging_level_t level, pdf_string_t *context, pdf_string_t *message);
// Imported Functions from `wasi:io/poll@0.2.0`
// Return the readiness of a pollable. This function never blocks.
//
// Returns `true` when the pollable is ready, and `false` otherwise.
extern bool wasi_io_poll_method_pollable_ready(wasi_io_poll_borrow_pollable_t self);
// `block` returns immediately if the pollable is ready, and otherwise
// blocks until ready.
//
// This function is equivalent to calling `poll.poll` on a list
// containing only this pollable.
extern void wasi_io_poll_method_pollable_block(wasi_io_poll_borrow_pollable_t self);
// Poll for completion on a set of pollables.
//
// This function takes a list of pollables, which identify I/O sources of
// interest, and waits until one or more of the events is ready for I/O.
//
// The result `list<u32>` contains one or more indices of handles in the
// argument list that is ready for I/O.
//
// If the list contains more elements than can be indexed with a `u32`
// value, this function traps.
//
// A timeout can be implemented by adding a pollable from the
// wasi-clocks API to the list.
//
// This function does not return a `result`; polling in itself does not
// do any I/O so it doesn't fail. If any of the I/O sources identified by
// the pollables has an error, it is indicated by marking the source as
// being reaedy for I/O.
extern void wasi_io_poll_poll(wasi_io_poll_list_borrow_pollable_t *in, pdf_list_u32_t *ret);
// Imported Functions from `wasi:clocks/monotonic-clock@0.2.0`
// Read the current value of the clock.
//
// The clock is monotonic, therefore calling this function repeatedly will
// produce a sequence of non-decreasing values.
extern wasi_clocks_monotonic_clock_instant_t wasi_clocks_monotonic_clock_now(void);
// Query the resolution of the clock. Returns the duration of time
// corresponding to a clock tick.
extern wasi_clocks_monotonic_clock_duration_t wasi_clocks_monotonic_clock_resolution(void);
// Create a `pollable` which will resolve once the specified instant
// occured.
extern wasi_clocks_monotonic_clock_own_pollable_t wasi_clocks_monotonic_clock_subscribe_instant(wasi_clocks_monotonic_clock_instant_t when);
// Create a `pollable` which will resolve once the given duration has
// elapsed, starting at the time at which this function was called.
// occured.
extern wasi_clocks_monotonic_clock_own_pollable_t wasi_clocks_monotonic_clock_subscribe_duration(wasi_clocks_monotonic_clock_duration_t when);
// Imported Functions from `wasi:io/error@0.2.0`
// Returns a string that is suitable to assist humans in debugging
// this error.
//
// WARNING: The returned string should not be consumed mechanically!
// It may change across platforms, hosts, or other implementation
// details. Parsing this string is a major platform-compatibility
// hazard.
extern void wasi_io_error_method_error_to_debug_string(wasi_io_error_borrow_error_t self, pdf_string_t *ret);
// Imported Functions from `wasi:io/streams@0.2.0`
// Perform a non-blocking read from the stream.
//
// When the source of a `read` is binary data, the bytes from the source
// are returned verbatim. When the source of a `read` is known to the
// implementation to be text, bytes containing the UTF-8 encoding of the
// text are returned.
//
// This function returns a list of bytes containing the read data,
// when successful. The returned list will contain up to `len` bytes;
// it may return fewer than requested, but not more. The list is
// empty when no bytes are available for reading at this time. The
// pollable given by `subscribe` will be ready when more bytes are
// available.
//
// This function fails with a `stream-error` when the operation
// encounters an error, giving `last-operation-failed`, or when the
// stream is closed, giving `closed`.
//
// When the caller gives a `len` of 0, it represents a request to
// read 0 bytes. If the stream is still open, this call should
// succeed and return an empty list, or otherwise fail with `closed`.
//
// The `len` parameter is a `u64`, which could represent a list of u8 which
// is not possible to allocate in wasm32, or not desirable to allocate as
// as a return value by the callee. The callee may return a list of bytes
// less than `len` in size while more bytes are available for reading.
extern bool wasi_io_streams_method_input_stream_read(wasi_io_streams_borrow_input_stream_t self, uint64_t len, pdf_list_u8_t *ret, wasi_io_streams_stream_error_t *err);
// Read bytes from a stream, after blocking until at least one byte can
// be read. Except for blocking, behavior is identical to `read`.
extern bool wasi_io_streams_method_input_stream_blocking_read(wasi_io_streams_borrow_input_stream_t self, uint64_t len, pdf_list_u8_t *ret, wasi_io_streams_stream_error_t *err);
// Skip bytes from a stream. Returns number of bytes skipped.
//
// Behaves identical to `read`, except instead of returning a list
// of bytes, returns the number of bytes consumed from the stream.
extern bool wasi_io_streams_method_input_stream_skip(wasi_io_streams_borrow_input_stream_t self, uint64_t len, uint64_t *ret, wasi_io_streams_stream_error_t *err);
// Skip bytes from a stream, after blocking until at least one byte
// can be skipped. Except for blocking behavior, identical to `skip`.
extern bool wasi_io_streams_method_input_stream_blocking_skip(wasi_io_streams_borrow_input_stream_t self, uint64_t len, uint64_t *ret, wasi_io_streams_stream_error_t *err);
// Create a `pollable` which will resolve once either the specified stream
// has bytes available to read or the other end of the stream has been
// closed.
// The created `pollable` is a child resource of the `input-stream`.
// Implementations may trap if the `input-stream` is dropped before
// all derived `pollable`s created with this function are dropped.
extern wasi_io_streams_own_pollable_t wasi_io_streams_method_input_stream_subscribe(wasi_io_streams_borrow_input_stream_t self);
// Check readiness for writing. This function never blocks.
//
// Returns the number of bytes permitted for the next call to `write`,
// or an error. Calling `write` with more bytes than this function has
// permitted will trap.
//
// When this function returns 0 bytes, the `subscribe` pollable will
// become ready when this function will report at least 1 byte, or an
// error.
extern bool wasi_io_streams_method_output_stream_check_write(wasi_io_streams_borrow_output_stream_t self, uint64_t *ret, wasi_io_streams_stream_error_t *err);
// Perform a write. This function never blocks.
//
// When the destination of a `write` is binary data, the bytes from
// `contents` are written verbatim. When the destination of a `write` is
// known to the implementation to be text, the bytes of `contents` are
// transcoded from UTF-8 into the encoding of the destination and then
// written.
//
// Precondition: check-write gave permit of Ok(n) and contents has a
// length of less than or equal to n. Otherwise, this function will trap.
//
// returns Err(closed) without writing if the stream has closed since
// the last call to check-write provided a permit.
extern bool wasi_io_streams_method_output_stream_write(wasi_io_streams_borrow_output_stream_t self, pdf_list_u8_t *contents, wasi_io_streams_stream_error_t *err);
// Perform a write of up to 4096 bytes, and then flush the stream. Block
// until all of these operations are complete, or an error occurs.
//
// This is a convenience wrapper around the use of `check-write`,
// `subscribe`, `write`, and `flush`, and is implemented with the
// following pseudo-code:
//
// ```text
// let pollable = this.subscribe();
// while !contents.is_empty() {
// // Wait for the stream to become writable
// pollable.block();
// let Ok(n) = this.check-write(); // eliding error handling
// let len = min(n, contents.len());
// let (chunk, rest) = contents.split_at(len);
// this.write(chunk ); // eliding error handling
// contents = rest;
// }
// this.flush();
// // Wait for completion of `flush`
// pollable.block();
// // Check for any errors that arose during `flush`
// let _ = this.check-write(); // eliding error handling
// ```
extern bool wasi_io_streams_method_output_stream_blocking_write_and_flush(wasi_io_streams_borrow_output_stream_t self, pdf_list_u8_t *contents, wasi_io_streams_stream_error_t *err);
// Request to flush buffered output. This function never blocks.
//
// This tells the output-stream that the caller intends any buffered
// output to be flushed. the output which is expected to be flushed
// is all that has been passed to `write` prior to this call.
//
// Upon calling this function, the `output-stream` will not accept any
// writes (`check-write` will return `ok(0)`) until the flush has
// completed. The `subscribe` pollable will become ready when the
// flush has completed and the stream can accept more writes.
extern bool wasi_io_streams_method_output_stream_flush(wasi_io_streams_borrow_output_stream_t self, wasi_io_streams_stream_error_t *err);
// Request to flush buffered output, and block until flush completes
// and stream is ready for writing again.
extern bool wasi_io_streams_method_output_stream_blocking_flush(wasi_io_streams_borrow_output_stream_t self, wasi_io_streams_stream_error_t *err);
// Create a `pollable` which will resolve once the output-stream
// is ready for more writing, or an error has occured. When this
// pollable is ready, `check-write` will return `ok(n)` with n>0, or an
// error.
//
// If the stream is closed, this pollable is always ready immediately.
//
// The created `pollable` is a child resource of the `output-stream`.
// Implementations may trap if the `output-stream` is dropped before
// all derived `pollable`s created with this function are dropped.
extern wasi_io_streams_own_pollable_t wasi_io_streams_method_output_stream_subscribe(wasi_io_streams_borrow_output_stream_t self);
// Write zeroes to a stream.
//
// This should be used precisely like `write` with the exact same
// preconditions (must use check-write first), but instead of
// passing a list of bytes, you simply pass the number of zero-bytes
// that should be written.
extern bool wasi_io_streams_method_output_stream_write_zeroes(wasi_io_streams_borrow_output_stream_t self, uint64_t len, wasi_io_streams_stream_error_t *err);
// Perform a write of up to 4096 zeroes, and then flush the stream.
// Block until all of these operations are complete, or an error
// occurs.
//
// This is a convenience wrapper around the use of `check-write`,
// `subscribe`, `write-zeroes`, and `flush`, and is implemented with
// the following pseudo-code:
//
// ```text
// let pollable = this.subscribe();
// while num_zeroes != 0 {
// // Wait for the stream to become writable
// pollable.block();
// let Ok(n) = this.check-write(); // eliding error handling
// let len = min(n, num_zeroes);
// this.write-zeroes(len); // eliding error handling
// num_zeroes -= len;
// }
// this.flush();
// // Wait for completion of `flush`
// pollable.block();
// // Check for any errors that arose during `flush`
// let _ = this.check-write(); // eliding error handling
// ```
extern bool wasi_io_streams_method_output_stream_blocking_write_zeroes_and_flush(wasi_io_streams_borrow_output_stream_t self, uint64_t len, wasi_io_streams_stream_error_t *err);
// Read from one stream and write to another.
//
// The behavior of splice is equivelant to:
// 1. calling `check-write` on the `output-stream`
// 2. calling `read` on the `input-stream` with the smaller of the
// `check-write` permitted length and the `len` provided to `splice`
// 3. calling `write` on the `output-stream` with that read data.
//
// Any error reported by the call to `check-write`, `read`, or
// `write` ends the splice and reports that error.
//
// This function returns the number of bytes transferred; it may be less
// than `len`.
extern bool wasi_io_streams_method_output_stream_splice(wasi_io_streams_borrow_output_stream_t self, wasi_io_streams_borrow_input_stream_t src, uint64_t len, uint64_t *ret, wasi_io_streams_stream_error_t *err);
// Read from one stream and write to another, with blocking.
//
// This is similar to `splice`, except that it blocks until the
// `output-stream` is ready for writing, and the `input-stream`
// is ready for reading, before performing the `splice`.
extern bool wasi_io_streams_method_output_stream_blocking_splice(wasi_io_streams_borrow_output_stream_t self, wasi_io_streams_borrow_input_stream_t src, uint64_t len, uint64_t *ret, wasi_io_streams_stream_error_t *err);
// Imported Functions from `wasi:http/types@0.2.0`
// Attempts to extract a http-related `error` from the wasi:io `error`
// provided.
//
// Stream operations which return
// `wasi:io/stream/stream-error::last-operation-failed` have a payload of
// type `wasi:io/error/error` with more information about the operation
// that failed. This payload can be passed through to this function to see
// if there's http-related information about the error to return.
//
// Note that this function is fallible because not all io-errors are
// http-related errors.
extern bool wasi_http_types_http_error_code(wasi_http_types_borrow_io_error_t err_, wasi_http_types_error_code_t *ret);
// Construct an empty HTTP Fields.
//
// The resulting `fields` is mutable.
extern wasi_http_types_own_fields_t wasi_http_types_constructor_fields(void);
// Construct an HTTP Fields.
//
// The resulting `fields` is mutable.
//
// The list represents each key-value pair in the Fields. Keys
// which have multiple values are represented by multiple entries in this
// list with the same key.
//
// The tuple is a pair of the field key, represented as a string, and
// Value, represented as a list of bytes. In a valid Fields, all keys
// and values are valid UTF-8 strings. However, values are not always
// well-formed, so they are represented as a raw list of bytes.
//
// An error result will be returned if any header or value was
// syntactically invalid, or if a header was forbidden.
extern bool wasi_http_types_static_fields_from_list(pdf_list_tuple2_field_key_field_value_t *entries, wasi_http_types_own_fields_t *ret, wasi_http_types_header_error_t *err);
// Get all of the values corresponding to a key. If the key is not present
// in this `fields`, an empty list is returned. However, if the key is
// present but empty, this is represented by a list with one or more
// empty field-values present.
extern void wasi_http_types_method_fields_get(wasi_http_types_borrow_fields_t self, wasi_http_types_field_key_t *name, pdf_list_field_value_t *ret);
// Returns `true` when the key is present in this `fields`. If the key is
// syntactically invalid, `false` is returned.
extern bool wasi_http_types_method_fields_has(wasi_http_types_borrow_fields_t self, wasi_http_types_field_key_t *name);
// Set all of the values for a key. Clears any existing values for that
// key, if they have been set.
//
// Fails with `header-error.immutable` if the `fields` are immutable.
extern bool wasi_http_types_method_fields_set(wasi_http_types_borrow_fields_t self, wasi_http_types_field_key_t *name, pdf_list_field_value_t *value, wasi_http_types_header_error_t *err);
// Delete all values for a key. Does nothing if no values for the key
// exist.
//
// Fails with `header-error.immutable` if the `fields` are immutable.
extern bool wasi_http_types_method_fields_delete(wasi_http_types_borrow_fields_t self, wasi_http_types_field_key_t *name, wasi_http_types_header_error_t *err);
// Append a value for a key. Does not change or delete any existing
// values for that key.
//
// Fails with `header-error.immutable` if the `fields` are immutable.
extern bool wasi_http_types_method_fields_append(wasi_http_types_borrow_fields_t self, wasi_http_types_field_key_t *name, wasi_http_types_field_value_t *value, wasi_http_types_header_error_t *err);
// Retrieve the full set of keys and values in the Fields. Like the
// constructor, the list represents each key-value pair.
//
// The outer list represents each key-value pair in the Fields. Keys
// which have multiple values are represented by multiple entries in this
// list with the same key.
extern void wasi_http_types_method_fields_entries(wasi_http_types_borrow_fields_t self, pdf_list_tuple2_field_key_field_value_t *ret);
// Make a deep copy of the Fields. Equivelant in behavior to calling the
// `fields` constructor on the return value of `entries`. The resulting
// `fields` is mutable.
extern wasi_http_types_own_fields_t wasi_http_types_method_fields_clone(wasi_http_types_borrow_fields_t self);
// Returns the method of the incoming request.
extern void wasi_http_types_method_incoming_request_method(wasi_http_types_borrow_incoming_request_t self, wasi_http_types_method_t *ret);
// Returns the path with query parameters from the request, as a string.
extern bool wasi_http_types_method_incoming_request_path_with_query(wasi_http_types_borrow_incoming_request_t self, pdf_string_t *ret);
// Returns the protocol scheme from the request.
extern bool wasi_http_types_method_incoming_request_scheme(wasi_http_types_borrow_incoming_request_t self, wasi_http_types_scheme_t *ret);
// Returns the authority from the request, if it was present.
extern bool wasi_http_types_method_incoming_request_authority(wasi_http_types_borrow_incoming_request_t self, pdf_string_t *ret);
// Get the `headers` associated with the request.
//
// The returned `headers` resource is immutable: `set`, `append`, and
// `delete` operations will fail with `header-error.immutable`.
//
// The `headers` returned are a child resource: it must be dropped before
// the parent `incoming-request` is dropped. Dropping this
// `incoming-request` before all children are dropped will trap.
extern wasi_http_types_own_headers_t wasi_http_types_method_incoming_request_headers(wasi_http_types_borrow_incoming_request_t self);
// Gives the `incoming-body` associated with this request. Will only
// return success at most once, and subsequent calls will return error.
extern bool wasi_http_types_method_incoming_request_consume(wasi_http_types_borrow_incoming_request_t self, wasi_http_types_own_incoming_body_t *ret);
// Construct a new `outgoing-request` with a default `method` of `GET`, and
// `none` values for `path-with-query`, `scheme`, and `authority`.
//
// * `headers` is the HTTP Headers for the Request.
//
// It is possible to construct, or manipulate with the accessor functions
// below, an `outgoing-request` with an invalid combination of `scheme`
// and `authority`, or `headers` which are not permitted to be sent.
// It is the obligation of the `outgoing-handler.handle` implementation
// to reject invalid constructions of `outgoing-request`.
extern wasi_http_types_own_outgoing_request_t wasi_http_types_constructor_outgoing_request(wasi_http_types_own_headers_t headers);
// Returns the resource corresponding to the outgoing Body for this
// Request.
//
// Returns success on the first call: the `outgoing-body` resource for
// this `outgoing-request` can be retrieved at most once. Subsequent
// calls will return error.
extern bool wasi_http_types_method_outgoing_request_body(wasi_http_types_borrow_outgoing_request_t self, wasi_http_types_own_outgoing_body_t *ret);
// Get the Method for the Request.
extern void wasi_http_types_method_outgoing_request_method(wasi_http_types_borrow_outgoing_request_t self, wasi_http_types_method_t *ret);
// Set the Method for the Request. Fails if the string present in a
// `method.other` argument is not a syntactically valid method.
extern bool wasi_http_types_method_outgoing_request_set_method(wasi_http_types_borrow_outgoing_request_t self, wasi_http_types_method_t *method);
// Get the combination of the HTTP Path and Query for the Request.
// When `none`, this represents an empty Path and empty Query.
extern bool wasi_http_types_method_outgoing_request_path_with_query(wasi_http_types_borrow_outgoing_request_t self, pdf_string_t *ret);
// Set the combination of the HTTP Path and Query for the Request.
// When `none`, this represents an empty Path and empty Query. Fails is the
// string given is not a syntactically valid path and query uri component.
extern bool wasi_http_types_method_outgoing_request_set_path_with_query(wasi_http_types_borrow_outgoing_request_t self, pdf_string_t *maybe_path_with_query);
// Get the HTTP Related Scheme for the Request. When `none`, the
// implementation may choose an appropriate default scheme.
extern bool wasi_http_types_method_outgoing_request_scheme(wasi_http_types_borrow_outgoing_request_t self, wasi_http_types_scheme_t *ret);
// Set the HTTP Related Scheme for the Request. When `none`, the
// implementation may choose an appropriate default scheme. Fails if the
// string given is not a syntactically valid uri scheme.
extern bool wasi_http_types_method_outgoing_request_set_scheme(wasi_http_types_borrow_outgoing_request_t self, wasi_http_types_scheme_t *maybe_scheme);
// Get the HTTP Authority for the Request. A value of `none` may be used
// with Related Schemes which do not require an Authority. The HTTP and
// HTTPS schemes always require an authority.
extern bool wasi_http_types_method_outgoing_request_authority(wasi_http_types_borrow_outgoing_request_t self, pdf_string_t *ret);
// Set the HTTP Authority for the Request. A value of `none` may be used
// with Related Schemes which do not require an Authority. The HTTP and
// HTTPS schemes always require an authority. Fails if the string given is
// not a syntactically valid uri authority.
extern bool wasi_http_types_method_outgoing_request_set_authority(wasi_http_types_borrow_outgoing_request_t self, pdf_string_t *maybe_authority);
// Get the headers associated with the Request.
//
// The returned `headers` resource is immutable: `set`, `append`, and
// `delete` operations will fail with `header-error.immutable`.
//
// This headers resource is a child: it must be dropped before the parent
// `outgoing-request` is dropped, or its ownership is transfered to
// another component by e.g. `outgoing-handler.handle`.
extern wasi_http_types_own_headers_t wasi_http_types_method_outgoing_request_headers(wasi_http_types_borrow_outgoing_request_t self);
// Construct a default `request-options` value.
extern wasi_http_types_own_request_options_t wasi_http_types_constructor_request_options(void);
// The timeout for the initial connect to the HTTP Server.
extern bool wasi_http_types_method_request_options_connect_timeout(wasi_http_types_borrow_request_options_t self, wasi_http_types_duration_t *ret);
// Set the timeout for the initial connect to the HTTP Server. An error
// return value indicates that this timeout is not supported.
extern bool wasi_http_types_method_request_options_set_connect_timeout(wasi_http_types_borrow_request_options_t self, wasi_http_types_duration_t *maybe_duration);
// The timeout for receiving the first byte of the Response body.
extern bool wasi_http_types_method_request_options_first_byte_timeout(wasi_http_types_borrow_request_options_t self, wasi_http_types_duration_t *ret);
// Set the timeout for receiving the first byte of the Response body. An
// error return value indicates that this timeout is not supported.
extern bool wasi_http_types_method_request_options_set_first_byte_timeout(wasi_http_types_borrow_request_options_t self, wasi_http_types_duration_t *maybe_duration);
// The timeout for receiving subsequent chunks of bytes in the Response
// body stream.
extern bool wasi_http_types_method_request_options_between_bytes_timeout(wasi_http_types_borrow_request_options_t self, wasi_http_types_duration_t *ret);
// Set the timeout for receiving subsequent chunks of bytes in the Response
// body stream. An error return value indicates that this timeout is not
// supported.
extern bool wasi_http_types_method_request_options_set_between_bytes_timeout(wasi_http_types_borrow_request_options_t self, wasi_http_types_duration_t *maybe_duration);
// Set the value of the `response-outparam` to either send a response,
// or indicate an error.
//
// This method consumes the `response-outparam` to ensure that it is
// called at most once. If it is never called, the implementation
// will respond with an error.
//
// The user may provide an `error` to `response` to allow the
// implementation determine how to respond with an HTTP error response.
extern void wasi_http_types_static_response_outparam_set(wasi_http_types_own_response_outparam_t param, wasi_http_types_result_own_outgoing_response_error_code_t *response);
// Returns the status code from the incoming response.
extern wasi_http_types_status_code_t wasi_http_types_method_incoming_response_status(wasi_http_types_borrow_incoming_response_t self);
// Returns the headers from the incoming response.
//
// The returned `headers` resource is immutable: `set`, `append`, and
// `delete` operations will fail with `header-error.immutable`.
//
// This headers resource is a child: it must be dropped before the parent
// `incoming-response` is dropped.
extern wasi_http_types_own_headers_t wasi_http_types_method_incoming_response_headers(wasi_http_types_borrow_incoming_response_t self);
// Returns the incoming body. May be called at most once. Returns error
// if called additional times.
extern bool wasi_http_types_method_incoming_response_consume(wasi_http_types_borrow_incoming_response_t self, wasi_http_types_own_incoming_body_t *ret);
// Returns the contents of the body, as a stream of bytes.
//
// Returns success on first call: the stream representing the contents
// can be retrieved at most once. Subsequent calls will return error.
//
// The returned `input-stream` resource is a child: it must be dropped
// before the parent `incoming-body` is dropped, or consumed by
// `incoming-body.finish`.
//
// This invariant ensures that the implementation can determine whether
// the user is consuming the contents of the body, waiting on the
// `future-trailers` to be ready, or neither. This allows for network
// backpressure is to be applied when the user is consuming the body,
// and for that backpressure to not inhibit delivery of the trailers if
// the user does not read the entire body.
extern bool wasi_http_types_method_incoming_body_stream(wasi_http_types_borrow_incoming_body_t self, wasi_http_types_own_input_stream_t *ret);
// Takes ownership of `incoming-body`, and returns a `future-trailers`.
// This function will trap if the `input-stream` child is still alive.
extern wasi_http_types_own_future_trailers_t wasi_http_types_static_incoming_body_finish(wasi_http_types_own_incoming_body_t this_);
// Returns a pollable which becomes ready when either the trailers have