wasip2/
proxy.rs

1// Generated by `wit-bindgen` 0.46.0. DO NOT EDIT!
2// Options used:
3//   * std_feature
4//   * with "wasi:cli/stdin@0.2.4" = "crate::cli::stdin"
5//   * with "wasi:cli/stdout@0.2.4" = "crate::cli::stdout"
6//   * with "wasi:cli/stderr@0.2.4" = "crate::cli::stderr"
7//   * with "wasi:clocks/monotonic-clock@0.2.4" = "crate::clocks::monotonic_clock"
8//   * with "wasi:clocks/wall-clock@0.2.4" = "crate::clocks::wall_clock"
9//   * with "wasi:io/error@0.2.4" = "crate::io::error"
10//   * with "wasi:io/poll@0.2.4" = "crate::io::poll"
11//   * with "wasi:io/streams@0.2.4" = "crate::io::streams"
12//   * with "wasi:random/random@0.2.4" = "crate::random::random"
13//   * type_section_suffix: "rust-wasip2-1.0.1+wasi-0.2.4-from-crates-io-proxy-world"
14//   * default-bindings-module: "$crate"
15//   * export-macro-name: _export_proxy
16//   * pub-export-macro
17#[allow(unfulfilled_lint_expectations, unused_imports)]
18use crate::io::poll as __with_name0;
19#[allow(unfulfilled_lint_expectations, unused_imports)]
20use crate::clocks::monotonic_clock as __with_name1;
21#[allow(unfulfilled_lint_expectations, unused_imports)]
22use crate::clocks::wall_clock as __with_name2;
23#[allow(unfulfilled_lint_expectations, unused_imports)]
24use crate::random::random as __with_name3;
25#[allow(unfulfilled_lint_expectations, unused_imports)]
26use crate::io::error as __with_name4;
27#[allow(unfulfilled_lint_expectations, unused_imports)]
28use crate::io::streams as __with_name5;
29#[allow(unfulfilled_lint_expectations, unused_imports)]
30use crate::cli::stdout as __with_name6;
31#[allow(unfulfilled_lint_expectations, unused_imports)]
32use crate::cli::stderr as __with_name7;
33#[allow(unfulfilled_lint_expectations, unused_imports)]
34use crate::cli::stdin as __with_name8;
35#[rustfmt::skip]
36#[allow(dead_code, clippy::all)]
37pub mod wasi {
38    pub mod http {
39        /// This interface defines all of the types and methods for implementing
40        /// HTTP Requests and Responses, both incoming and outgoing, as well as
41        /// their headers, trailers, and bodies.
42        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
43        pub mod types {
44            #[used]
45            #[doc(hidden)]
46            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
47            use super::super::super::_rt;
48            pub type Duration = super::super::super::__with_name1::Duration;
49            pub type InputStream = super::super::super::__with_name5::InputStream;
50            pub type OutputStream = super::super::super::__with_name5::OutputStream;
51            pub type IoError = super::super::super::__with_name4::Error;
52            pub type Pollable = super::super::super::__with_name0::Pollable;
53            /// This type corresponds to HTTP standard Methods.
54            #[derive(Clone)]
55            pub enum Method {
56                Get,
57                Head,
58                Post,
59                Put,
60                Delete,
61                Connect,
62                Options,
63                Trace,
64                Patch,
65                Other(_rt::String),
66            }
67            impl ::core::fmt::Debug for Method {
68                fn fmt(
69                    &self,
70                    f: &mut ::core::fmt::Formatter<'_>,
71                ) -> ::core::fmt::Result {
72                    match self {
73                        Method::Get => f.debug_tuple("Method::Get").finish(),
74                        Method::Head => f.debug_tuple("Method::Head").finish(),
75                        Method::Post => f.debug_tuple("Method::Post").finish(),
76                        Method::Put => f.debug_tuple("Method::Put").finish(),
77                        Method::Delete => f.debug_tuple("Method::Delete").finish(),
78                        Method::Connect => f.debug_tuple("Method::Connect").finish(),
79                        Method::Options => f.debug_tuple("Method::Options").finish(),
80                        Method::Trace => f.debug_tuple("Method::Trace").finish(),
81                        Method::Patch => f.debug_tuple("Method::Patch").finish(),
82                        Method::Other(e) => {
83                            f.debug_tuple("Method::Other").field(e).finish()
84                        }
85                    }
86                }
87            }
88            /// This type corresponds to HTTP standard Related Schemes.
89            #[derive(Clone)]
90            pub enum Scheme {
91                Http,
92                Https,
93                Other(_rt::String),
94            }
95            impl ::core::fmt::Debug for Scheme {
96                fn fmt(
97                    &self,
98                    f: &mut ::core::fmt::Formatter<'_>,
99                ) -> ::core::fmt::Result {
100                    match self {
101                        Scheme::Http => f.debug_tuple("Scheme::Http").finish(),
102                        Scheme::Https => f.debug_tuple("Scheme::Https").finish(),
103                        Scheme::Other(e) => {
104                            f.debug_tuple("Scheme::Other").field(e).finish()
105                        }
106                    }
107                }
108            }
109            /// Defines the case payload type for `DNS-error` above:
110            #[derive(Clone)]
111            pub struct DnsErrorPayload {
112                pub rcode: Option<_rt::String>,
113                pub info_code: Option<u16>,
114            }
115            impl ::core::fmt::Debug for DnsErrorPayload {
116                fn fmt(
117                    &self,
118                    f: &mut ::core::fmt::Formatter<'_>,
119                ) -> ::core::fmt::Result {
120                    f.debug_struct("DnsErrorPayload")
121                        .field("rcode", &self.rcode)
122                        .field("info-code", &self.info_code)
123                        .finish()
124                }
125            }
126            /// Defines the case payload type for `TLS-alert-received` above:
127            #[derive(Clone)]
128            pub struct TlsAlertReceivedPayload {
129                pub alert_id: Option<u8>,
130                pub alert_message: Option<_rt::String>,
131            }
132            impl ::core::fmt::Debug for TlsAlertReceivedPayload {
133                fn fmt(
134                    &self,
135                    f: &mut ::core::fmt::Formatter<'_>,
136                ) -> ::core::fmt::Result {
137                    f.debug_struct("TlsAlertReceivedPayload")
138                        .field("alert-id", &self.alert_id)
139                        .field("alert-message", &self.alert_message)
140                        .finish()
141                }
142            }
143            /// Defines the case payload type for `HTTP-response-{header,trailer}-size` above:
144            #[derive(Clone)]
145            pub struct FieldSizePayload {
146                pub field_name: Option<_rt::String>,
147                pub field_size: Option<u32>,
148            }
149            impl ::core::fmt::Debug for FieldSizePayload {
150                fn fmt(
151                    &self,
152                    f: &mut ::core::fmt::Formatter<'_>,
153                ) -> ::core::fmt::Result {
154                    f.debug_struct("FieldSizePayload")
155                        .field("field-name", &self.field_name)
156                        .field("field-size", &self.field_size)
157                        .finish()
158                }
159            }
160            /// These cases are inspired by the IANA HTTP Proxy Error Types:
161            ///   <https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types>
162            #[derive(Clone)]
163            pub enum ErrorCode {
164                DnsTimeout,
165                DnsError(DnsErrorPayload),
166                DestinationNotFound,
167                DestinationUnavailable,
168                DestinationIpProhibited,
169                DestinationIpUnroutable,
170                ConnectionRefused,
171                ConnectionTerminated,
172                ConnectionTimeout,
173                ConnectionReadTimeout,
174                ConnectionWriteTimeout,
175                ConnectionLimitReached,
176                TlsProtocolError,
177                TlsCertificateError,
178                TlsAlertReceived(TlsAlertReceivedPayload),
179                HttpRequestDenied,
180                HttpRequestLengthRequired,
181                HttpRequestBodySize(Option<u64>),
182                HttpRequestMethodInvalid,
183                HttpRequestUriInvalid,
184                HttpRequestUriTooLong,
185                HttpRequestHeaderSectionSize(Option<u32>),
186                HttpRequestHeaderSize(Option<FieldSizePayload>),
187                HttpRequestTrailerSectionSize(Option<u32>),
188                HttpRequestTrailerSize(FieldSizePayload),
189                HttpResponseIncomplete,
190                HttpResponseHeaderSectionSize(Option<u32>),
191                HttpResponseHeaderSize(FieldSizePayload),
192                HttpResponseBodySize(Option<u64>),
193                HttpResponseTrailerSectionSize(Option<u32>),
194                HttpResponseTrailerSize(FieldSizePayload),
195                HttpResponseTransferCoding(Option<_rt::String>),
196                HttpResponseContentCoding(Option<_rt::String>),
197                HttpResponseTimeout,
198                HttpUpgradeFailed,
199                HttpProtocolError,
200                LoopDetected,
201                ConfigurationError,
202                /// This is a catch-all error for anything that doesn't fit cleanly into a
203                /// more specific case. It also includes an optional string for an
204                /// unstructured description of the error. Users should not depend on the
205                /// string for diagnosing errors, as it's not required to be consistent
206                /// between implementations.
207                InternalError(Option<_rt::String>),
208            }
209            impl ::core::fmt::Debug for ErrorCode {
210                fn fmt(
211                    &self,
212                    f: &mut ::core::fmt::Formatter<'_>,
213                ) -> ::core::fmt::Result {
214                    match self {
215                        ErrorCode::DnsTimeout => {
216                            f.debug_tuple("ErrorCode::DnsTimeout").finish()
217                        }
218                        ErrorCode::DnsError(e) => {
219                            f.debug_tuple("ErrorCode::DnsError").field(e).finish()
220                        }
221                        ErrorCode::DestinationNotFound => {
222                            f.debug_tuple("ErrorCode::DestinationNotFound").finish()
223                        }
224                        ErrorCode::DestinationUnavailable => {
225                            f.debug_tuple("ErrorCode::DestinationUnavailable").finish()
226                        }
227                        ErrorCode::DestinationIpProhibited => {
228                            f.debug_tuple("ErrorCode::DestinationIpProhibited").finish()
229                        }
230                        ErrorCode::DestinationIpUnroutable => {
231                            f.debug_tuple("ErrorCode::DestinationIpUnroutable").finish()
232                        }
233                        ErrorCode::ConnectionRefused => {
234                            f.debug_tuple("ErrorCode::ConnectionRefused").finish()
235                        }
236                        ErrorCode::ConnectionTerminated => {
237                            f.debug_tuple("ErrorCode::ConnectionTerminated").finish()
238                        }
239                        ErrorCode::ConnectionTimeout => {
240                            f.debug_tuple("ErrorCode::ConnectionTimeout").finish()
241                        }
242                        ErrorCode::ConnectionReadTimeout => {
243                            f.debug_tuple("ErrorCode::ConnectionReadTimeout").finish()
244                        }
245                        ErrorCode::ConnectionWriteTimeout => {
246                            f.debug_tuple("ErrorCode::ConnectionWriteTimeout").finish()
247                        }
248                        ErrorCode::ConnectionLimitReached => {
249                            f.debug_tuple("ErrorCode::ConnectionLimitReached").finish()
250                        }
251                        ErrorCode::TlsProtocolError => {
252                            f.debug_tuple("ErrorCode::TlsProtocolError").finish()
253                        }
254                        ErrorCode::TlsCertificateError => {
255                            f.debug_tuple("ErrorCode::TlsCertificateError").finish()
256                        }
257                        ErrorCode::TlsAlertReceived(e) => {
258                            f.debug_tuple("ErrorCode::TlsAlertReceived")
259                                .field(e)
260                                .finish()
261                        }
262                        ErrorCode::HttpRequestDenied => {
263                            f.debug_tuple("ErrorCode::HttpRequestDenied").finish()
264                        }
265                        ErrorCode::HttpRequestLengthRequired => {
266                            f.debug_tuple("ErrorCode::HttpRequestLengthRequired")
267                                .finish()
268                        }
269                        ErrorCode::HttpRequestBodySize(e) => {
270                            f.debug_tuple("ErrorCode::HttpRequestBodySize")
271                                .field(e)
272                                .finish()
273                        }
274                        ErrorCode::HttpRequestMethodInvalid => {
275                            f.debug_tuple("ErrorCode::HttpRequestMethodInvalid").finish()
276                        }
277                        ErrorCode::HttpRequestUriInvalid => {
278                            f.debug_tuple("ErrorCode::HttpRequestUriInvalid").finish()
279                        }
280                        ErrorCode::HttpRequestUriTooLong => {
281                            f.debug_tuple("ErrorCode::HttpRequestUriTooLong").finish()
282                        }
283                        ErrorCode::HttpRequestHeaderSectionSize(e) => {
284                            f.debug_tuple("ErrorCode::HttpRequestHeaderSectionSize")
285                                .field(e)
286                                .finish()
287                        }
288                        ErrorCode::HttpRequestHeaderSize(e) => {
289                            f.debug_tuple("ErrorCode::HttpRequestHeaderSize")
290                                .field(e)
291                                .finish()
292                        }
293                        ErrorCode::HttpRequestTrailerSectionSize(e) => {
294                            f.debug_tuple("ErrorCode::HttpRequestTrailerSectionSize")
295                                .field(e)
296                                .finish()
297                        }
298                        ErrorCode::HttpRequestTrailerSize(e) => {
299                            f.debug_tuple("ErrorCode::HttpRequestTrailerSize")
300                                .field(e)
301                                .finish()
302                        }
303                        ErrorCode::HttpResponseIncomplete => {
304                            f.debug_tuple("ErrorCode::HttpResponseIncomplete").finish()
305                        }
306                        ErrorCode::HttpResponseHeaderSectionSize(e) => {
307                            f.debug_tuple("ErrorCode::HttpResponseHeaderSectionSize")
308                                .field(e)
309                                .finish()
310                        }
311                        ErrorCode::HttpResponseHeaderSize(e) => {
312                            f.debug_tuple("ErrorCode::HttpResponseHeaderSize")
313                                .field(e)
314                                .finish()
315                        }
316                        ErrorCode::HttpResponseBodySize(e) => {
317                            f.debug_tuple("ErrorCode::HttpResponseBodySize")
318                                .field(e)
319                                .finish()
320                        }
321                        ErrorCode::HttpResponseTrailerSectionSize(e) => {
322                            f.debug_tuple("ErrorCode::HttpResponseTrailerSectionSize")
323                                .field(e)
324                                .finish()
325                        }
326                        ErrorCode::HttpResponseTrailerSize(e) => {
327                            f.debug_tuple("ErrorCode::HttpResponseTrailerSize")
328                                .field(e)
329                                .finish()
330                        }
331                        ErrorCode::HttpResponseTransferCoding(e) => {
332                            f.debug_tuple("ErrorCode::HttpResponseTransferCoding")
333                                .field(e)
334                                .finish()
335                        }
336                        ErrorCode::HttpResponseContentCoding(e) => {
337                            f.debug_tuple("ErrorCode::HttpResponseContentCoding")
338                                .field(e)
339                                .finish()
340                        }
341                        ErrorCode::HttpResponseTimeout => {
342                            f.debug_tuple("ErrorCode::HttpResponseTimeout").finish()
343                        }
344                        ErrorCode::HttpUpgradeFailed => {
345                            f.debug_tuple("ErrorCode::HttpUpgradeFailed").finish()
346                        }
347                        ErrorCode::HttpProtocolError => {
348                            f.debug_tuple("ErrorCode::HttpProtocolError").finish()
349                        }
350                        ErrorCode::LoopDetected => {
351                            f.debug_tuple("ErrorCode::LoopDetected").finish()
352                        }
353                        ErrorCode::ConfigurationError => {
354                            f.debug_tuple("ErrorCode::ConfigurationError").finish()
355                        }
356                        ErrorCode::InternalError(e) => {
357                            f.debug_tuple("ErrorCode::InternalError").field(e).finish()
358                        }
359                    }
360                }
361            }
362            impl ::core::fmt::Display for ErrorCode {
363                fn fmt(
364                    &self,
365                    f: &mut ::core::fmt::Formatter<'_>,
366                ) -> ::core::fmt::Result {
367                    write!(f, "{:?}", self)
368                }
369            }
370            #[cfg(feature = "std")]
371            impl std::error::Error for ErrorCode {}
372            /// This type enumerates the different kinds of errors that may occur when
373            /// setting or appending to a `fields` resource.
374            #[derive(Clone, Copy)]
375            pub enum HeaderError {
376                /// This error indicates that a `field-name` or `field-value` was
377                /// syntactically invalid when used with an operation that sets headers in a
378                /// `fields`.
379                InvalidSyntax,
380                /// This error indicates that a forbidden `field-name` was used when trying
381                /// to set a header in a `fields`.
382                Forbidden,
383                /// This error indicates that the operation on the `fields` was not
384                /// permitted because the fields are immutable.
385                Immutable,
386            }
387            impl ::core::fmt::Debug for HeaderError {
388                fn fmt(
389                    &self,
390                    f: &mut ::core::fmt::Formatter<'_>,
391                ) -> ::core::fmt::Result {
392                    match self {
393                        HeaderError::InvalidSyntax => {
394                            f.debug_tuple("HeaderError::InvalidSyntax").finish()
395                        }
396                        HeaderError::Forbidden => {
397                            f.debug_tuple("HeaderError::Forbidden").finish()
398                        }
399                        HeaderError::Immutable => {
400                            f.debug_tuple("HeaderError::Immutable").finish()
401                        }
402                    }
403                }
404            }
405            impl ::core::fmt::Display for HeaderError {
406                fn fmt(
407                    &self,
408                    f: &mut ::core::fmt::Formatter<'_>,
409                ) -> ::core::fmt::Result {
410                    write!(f, "{:?}", self)
411                }
412            }
413            #[cfg(feature = "std")]
414            impl std::error::Error for HeaderError {}
415            /// Field keys are always strings.
416            ///
417            /// Field keys should always be treated as case insensitive by the `fields`
418            /// resource for the purposes of equality checking.
419            ///
420            /// # Deprecation
421            ///
422            /// This type has been deprecated in favor of the `field-name` type.
423            pub type FieldKey = _rt::String;
424            /// Field names are always strings.
425            ///
426            /// Field names should always be treated as case insensitive by the `fields`
427            /// resource for the purposes of equality checking.
428            pub type FieldName = FieldKey;
429            /// Field values should always be ASCII strings. However, in
430            /// reality, HTTP implementations often have to interpret malformed values,
431            /// so they are provided as a list of bytes.
432            pub type FieldValue = _rt::Vec<u8>;
433            /// This following block defines the `fields` resource which corresponds to
434            /// HTTP standard Fields. Fields are a common representation used for both
435            /// Headers and Trailers.
436            ///
437            /// A `fields` may be mutable or immutable. A `fields` created using the
438            /// constructor, `from-list`, or `clone` will be mutable, but a `fields`
439            /// resource given by other means (including, but not limited to,
440            /// `incoming-request.headers`, `outgoing-request.headers`) might be
441            /// immutable. In an immutable fields, the `set`, `append`, and `delete`
442            /// operations will fail with `header-error.immutable`.
443            #[derive(Debug)]
444            #[repr(transparent)]
445            pub struct Fields {
446                handle: _rt::Resource<Fields>,
447            }
448            impl Fields {
449                #[doc(hidden)]
450                pub unsafe fn from_handle(handle: u32) -> Self {
451                    Self {
452                        handle: unsafe { _rt::Resource::from_handle(handle) },
453                    }
454                }
455                #[doc(hidden)]
456                pub fn take_handle(&self) -> u32 {
457                    _rt::Resource::take_handle(&self.handle)
458                }
459                #[doc(hidden)]
460                pub fn handle(&self) -> u32 {
461                    _rt::Resource::handle(&self.handle)
462                }
463            }
464            unsafe impl _rt::WasmResource for Fields {
465                #[inline]
466                unsafe fn drop(_handle: u32) {
467                    #[cfg(target_arch = "wasm32")]
468                    #[link(wasm_import_module = "wasi:http/types@0.2.4")]
469                    unsafe extern "C" {
470                        #[link_name = "[resource-drop]fields"]
471                        fn drop(_: i32);
472                    }
473                    #[cfg(not(target_arch = "wasm32"))]
474                    unsafe extern "C" fn drop(_: i32) {
475                        unreachable!()
476                    }
477                    unsafe {
478                        drop(_handle as i32);
479                    }
480                }
481            }
482            /// Headers is an alias for Fields.
483            pub type Headers = Fields;
484            /// Trailers is an alias for Fields.
485            pub type Trailers = Fields;
486            /// Represents an incoming HTTP Request.
487            #[derive(Debug)]
488            #[repr(transparent)]
489            pub struct IncomingRequest {
490                handle: _rt::Resource<IncomingRequest>,
491            }
492            impl IncomingRequest {
493                #[doc(hidden)]
494                pub unsafe fn from_handle(handle: u32) -> Self {
495                    Self {
496                        handle: unsafe { _rt::Resource::from_handle(handle) },
497                    }
498                }
499                #[doc(hidden)]
500                pub fn take_handle(&self) -> u32 {
501                    _rt::Resource::take_handle(&self.handle)
502                }
503                #[doc(hidden)]
504                pub fn handle(&self) -> u32 {
505                    _rt::Resource::handle(&self.handle)
506                }
507            }
508            unsafe impl _rt::WasmResource for IncomingRequest {
509                #[inline]
510                unsafe fn drop(_handle: u32) {
511                    #[cfg(target_arch = "wasm32")]
512                    #[link(wasm_import_module = "wasi:http/types@0.2.4")]
513                    unsafe extern "C" {
514                        #[link_name = "[resource-drop]incoming-request"]
515                        fn drop(_: i32);
516                    }
517                    #[cfg(not(target_arch = "wasm32"))]
518                    unsafe extern "C" fn drop(_: i32) {
519                        unreachable!()
520                    }
521                    unsafe {
522                        drop(_handle as i32);
523                    }
524                }
525            }
526            /// Represents an outgoing HTTP Request.
527            #[derive(Debug)]
528            #[repr(transparent)]
529            pub struct OutgoingRequest {
530                handle: _rt::Resource<OutgoingRequest>,
531            }
532            impl OutgoingRequest {
533                #[doc(hidden)]
534                pub unsafe fn from_handle(handle: u32) -> Self {
535                    Self {
536                        handle: unsafe { _rt::Resource::from_handle(handle) },
537                    }
538                }
539                #[doc(hidden)]
540                pub fn take_handle(&self) -> u32 {
541                    _rt::Resource::take_handle(&self.handle)
542                }
543                #[doc(hidden)]
544                pub fn handle(&self) -> u32 {
545                    _rt::Resource::handle(&self.handle)
546                }
547            }
548            unsafe impl _rt::WasmResource for OutgoingRequest {
549                #[inline]
550                unsafe fn drop(_handle: u32) {
551                    #[cfg(target_arch = "wasm32")]
552                    #[link(wasm_import_module = "wasi:http/types@0.2.4")]
553                    unsafe extern "C" {
554                        #[link_name = "[resource-drop]outgoing-request"]
555                        fn drop(_: i32);
556                    }
557                    #[cfg(not(target_arch = "wasm32"))]
558                    unsafe extern "C" fn drop(_: i32) {
559                        unreachable!()
560                    }
561                    unsafe {
562                        drop(_handle as i32);
563                    }
564                }
565            }
566            /// Parameters for making an HTTP Request. Each of these parameters is
567            /// currently an optional timeout applicable to the transport layer of the
568            /// HTTP protocol.
569            ///
570            /// These timeouts are separate from any the user may use to bound a
571            /// blocking call to `wasi:io/poll.poll`.
572            #[derive(Debug)]
573            #[repr(transparent)]
574            pub struct RequestOptions {
575                handle: _rt::Resource<RequestOptions>,
576            }
577            impl RequestOptions {
578                #[doc(hidden)]
579                pub unsafe fn from_handle(handle: u32) -> Self {
580                    Self {
581                        handle: unsafe { _rt::Resource::from_handle(handle) },
582                    }
583                }
584                #[doc(hidden)]
585                pub fn take_handle(&self) -> u32 {
586                    _rt::Resource::take_handle(&self.handle)
587                }
588                #[doc(hidden)]
589                pub fn handle(&self) -> u32 {
590                    _rt::Resource::handle(&self.handle)
591                }
592            }
593            unsafe impl _rt::WasmResource for RequestOptions {
594                #[inline]
595                unsafe fn drop(_handle: u32) {
596                    #[cfg(target_arch = "wasm32")]
597                    #[link(wasm_import_module = "wasi:http/types@0.2.4")]
598                    unsafe extern "C" {
599                        #[link_name = "[resource-drop]request-options"]
600                        fn drop(_: i32);
601                    }
602                    #[cfg(not(target_arch = "wasm32"))]
603                    unsafe extern "C" fn drop(_: i32) {
604                        unreachable!()
605                    }
606                    unsafe {
607                        drop(_handle as i32);
608                    }
609                }
610            }
611            /// Represents the ability to send an HTTP Response.
612            ///
613            /// This resource is used by the `wasi:http/incoming-handler` interface to
614            /// allow a Response to be sent corresponding to the Request provided as the
615            /// other argument to `incoming-handler.handle`.
616            #[derive(Debug)]
617            #[repr(transparent)]
618            pub struct ResponseOutparam {
619                handle: _rt::Resource<ResponseOutparam>,
620            }
621            impl ResponseOutparam {
622                #[doc(hidden)]
623                pub unsafe fn from_handle(handle: u32) -> Self {
624                    Self {
625                        handle: unsafe { _rt::Resource::from_handle(handle) },
626                    }
627                }
628                #[doc(hidden)]
629                pub fn take_handle(&self) -> u32 {
630                    _rt::Resource::take_handle(&self.handle)
631                }
632                #[doc(hidden)]
633                pub fn handle(&self) -> u32 {
634                    _rt::Resource::handle(&self.handle)
635                }
636            }
637            unsafe impl _rt::WasmResource for ResponseOutparam {
638                #[inline]
639                unsafe fn drop(_handle: u32) {
640                    #[cfg(target_arch = "wasm32")]
641                    #[link(wasm_import_module = "wasi:http/types@0.2.4")]
642                    unsafe extern "C" {
643                        #[link_name = "[resource-drop]response-outparam"]
644                        fn drop(_: i32);
645                    }
646                    #[cfg(not(target_arch = "wasm32"))]
647                    unsafe extern "C" fn drop(_: i32) {
648                        unreachable!()
649                    }
650                    unsafe {
651                        drop(_handle as i32);
652                    }
653                }
654            }
655            /// This type corresponds to the HTTP standard Status Code.
656            pub type StatusCode = u16;
657            /// Represents an incoming HTTP Response.
658            #[derive(Debug)]
659            #[repr(transparent)]
660            pub struct IncomingResponse {
661                handle: _rt::Resource<IncomingResponse>,
662            }
663            impl IncomingResponse {
664                #[doc(hidden)]
665                pub unsafe fn from_handle(handle: u32) -> Self {
666                    Self {
667                        handle: unsafe { _rt::Resource::from_handle(handle) },
668                    }
669                }
670                #[doc(hidden)]
671                pub fn take_handle(&self) -> u32 {
672                    _rt::Resource::take_handle(&self.handle)
673                }
674                #[doc(hidden)]
675                pub fn handle(&self) -> u32 {
676                    _rt::Resource::handle(&self.handle)
677                }
678            }
679            unsafe impl _rt::WasmResource for IncomingResponse {
680                #[inline]
681                unsafe fn drop(_handle: u32) {
682                    #[cfg(target_arch = "wasm32")]
683                    #[link(wasm_import_module = "wasi:http/types@0.2.4")]
684                    unsafe extern "C" {
685                        #[link_name = "[resource-drop]incoming-response"]
686                        fn drop(_: i32);
687                    }
688                    #[cfg(not(target_arch = "wasm32"))]
689                    unsafe extern "C" fn drop(_: i32) {
690                        unreachable!()
691                    }
692                    unsafe {
693                        drop(_handle as i32);
694                    }
695                }
696            }
697            /// Represents an incoming HTTP Request or Response's Body.
698            ///
699            /// A body has both its contents - a stream of bytes - and a (possibly
700            /// empty) set of trailers, indicating that the full contents of the
701            /// body have been received. This resource represents the contents as
702            /// an `input-stream` and the delivery of trailers as a `future-trailers`,
703            /// and ensures that the user of this interface may only be consuming either
704            /// the body contents or waiting on trailers at any given time.
705            #[derive(Debug)]
706            #[repr(transparent)]
707            pub struct IncomingBody {
708                handle: _rt::Resource<IncomingBody>,
709            }
710            impl IncomingBody {
711                #[doc(hidden)]
712                pub unsafe fn from_handle(handle: u32) -> Self {
713                    Self {
714                        handle: unsafe { _rt::Resource::from_handle(handle) },
715                    }
716                }
717                #[doc(hidden)]
718                pub fn take_handle(&self) -> u32 {
719                    _rt::Resource::take_handle(&self.handle)
720                }
721                #[doc(hidden)]
722                pub fn handle(&self) -> u32 {
723                    _rt::Resource::handle(&self.handle)
724                }
725            }
726            unsafe impl _rt::WasmResource for IncomingBody {
727                #[inline]
728                unsafe fn drop(_handle: u32) {
729                    #[cfg(target_arch = "wasm32")]
730                    #[link(wasm_import_module = "wasi:http/types@0.2.4")]
731                    unsafe extern "C" {
732                        #[link_name = "[resource-drop]incoming-body"]
733                        fn drop(_: i32);
734                    }
735                    #[cfg(not(target_arch = "wasm32"))]
736                    unsafe extern "C" fn drop(_: i32) {
737                        unreachable!()
738                    }
739                    unsafe {
740                        drop(_handle as i32);
741                    }
742                }
743            }
744            /// Represents a future which may eventually return trailers, or an error.
745            ///
746            /// In the case that the incoming HTTP Request or Response did not have any
747            /// trailers, this future will resolve to the empty set of trailers once the
748            /// complete Request or Response body has been received.
749            #[derive(Debug)]
750            #[repr(transparent)]
751            pub struct FutureTrailers {
752                handle: _rt::Resource<FutureTrailers>,
753            }
754            impl FutureTrailers {
755                #[doc(hidden)]
756                pub unsafe fn from_handle(handle: u32) -> Self {
757                    Self {
758                        handle: unsafe { _rt::Resource::from_handle(handle) },
759                    }
760                }
761                #[doc(hidden)]
762                pub fn take_handle(&self) -> u32 {
763                    _rt::Resource::take_handle(&self.handle)
764                }
765                #[doc(hidden)]
766                pub fn handle(&self) -> u32 {
767                    _rt::Resource::handle(&self.handle)
768                }
769            }
770            unsafe impl _rt::WasmResource for FutureTrailers {
771                #[inline]
772                unsafe fn drop(_handle: u32) {
773                    #[cfg(target_arch = "wasm32")]
774                    #[link(wasm_import_module = "wasi:http/types@0.2.4")]
775                    unsafe extern "C" {
776                        #[link_name = "[resource-drop]future-trailers"]
777                        fn drop(_: i32);
778                    }
779                    #[cfg(not(target_arch = "wasm32"))]
780                    unsafe extern "C" fn drop(_: i32) {
781                        unreachable!()
782                    }
783                    unsafe {
784                        drop(_handle as i32);
785                    }
786                }
787            }
788            /// Represents an outgoing HTTP Response.
789            #[derive(Debug)]
790            #[repr(transparent)]
791            pub struct OutgoingResponse {
792                handle: _rt::Resource<OutgoingResponse>,
793            }
794            impl OutgoingResponse {
795                #[doc(hidden)]
796                pub unsafe fn from_handle(handle: u32) -> Self {
797                    Self {
798                        handle: unsafe { _rt::Resource::from_handle(handle) },
799                    }
800                }
801                #[doc(hidden)]
802                pub fn take_handle(&self) -> u32 {
803                    _rt::Resource::take_handle(&self.handle)
804                }
805                #[doc(hidden)]
806                pub fn handle(&self) -> u32 {
807                    _rt::Resource::handle(&self.handle)
808                }
809            }
810            unsafe impl _rt::WasmResource for OutgoingResponse {
811                #[inline]
812                unsafe fn drop(_handle: u32) {
813                    #[cfg(target_arch = "wasm32")]
814                    #[link(wasm_import_module = "wasi:http/types@0.2.4")]
815                    unsafe extern "C" {
816                        #[link_name = "[resource-drop]outgoing-response"]
817                        fn drop(_: i32);
818                    }
819                    #[cfg(not(target_arch = "wasm32"))]
820                    unsafe extern "C" fn drop(_: i32) {
821                        unreachable!()
822                    }
823                    unsafe {
824                        drop(_handle as i32);
825                    }
826                }
827            }
828            /// Represents an outgoing HTTP Request or Response's Body.
829            ///
830            /// A body has both its contents - a stream of bytes - and a (possibly
831            /// empty) set of trailers, inducating the full contents of the body
832            /// have been sent. This resource represents the contents as an
833            /// `output-stream` child resource, and the completion of the body (with
834            /// optional trailers) with a static function that consumes the
835            /// `outgoing-body` resource, and ensures that the user of this interface
836            /// may not write to the body contents after the body has been finished.
837            ///
838            /// If the user code drops this resource, as opposed to calling the static
839            /// method `finish`, the implementation should treat the body as incomplete,
840            /// and that an error has occurred. The implementation should propagate this
841            /// error to the HTTP protocol by whatever means it has available,
842            /// including: corrupting the body on the wire, aborting the associated
843            /// Request, or sending a late status code for the Response.
844            #[derive(Debug)]
845            #[repr(transparent)]
846            pub struct OutgoingBody {
847                handle: _rt::Resource<OutgoingBody>,
848            }
849            impl OutgoingBody {
850                #[doc(hidden)]
851                pub unsafe fn from_handle(handle: u32) -> Self {
852                    Self {
853                        handle: unsafe { _rt::Resource::from_handle(handle) },
854                    }
855                }
856                #[doc(hidden)]
857                pub fn take_handle(&self) -> u32 {
858                    _rt::Resource::take_handle(&self.handle)
859                }
860                #[doc(hidden)]
861                pub fn handle(&self) -> u32 {
862                    _rt::Resource::handle(&self.handle)
863                }
864            }
865            unsafe impl _rt::WasmResource for OutgoingBody {
866                #[inline]
867                unsafe fn drop(_handle: u32) {
868                    #[cfg(target_arch = "wasm32")]
869                    #[link(wasm_import_module = "wasi:http/types@0.2.4")]
870                    unsafe extern "C" {
871                        #[link_name = "[resource-drop]outgoing-body"]
872                        fn drop(_: i32);
873                    }
874                    #[cfg(not(target_arch = "wasm32"))]
875                    unsafe extern "C" fn drop(_: i32) {
876                        unreachable!()
877                    }
878                    unsafe {
879                        drop(_handle as i32);
880                    }
881                }
882            }
883            /// Represents a future which may eventually return an incoming HTTP
884            /// Response, or an error.
885            ///
886            /// This resource is returned by the `wasi:http/outgoing-handler` interface to
887            /// provide the HTTP Response corresponding to the sent Request.
888            #[derive(Debug)]
889            #[repr(transparent)]
890            pub struct FutureIncomingResponse {
891                handle: _rt::Resource<FutureIncomingResponse>,
892            }
893            impl FutureIncomingResponse {
894                #[doc(hidden)]
895                pub unsafe fn from_handle(handle: u32) -> Self {
896                    Self {
897                        handle: unsafe { _rt::Resource::from_handle(handle) },
898                    }
899                }
900                #[doc(hidden)]
901                pub fn take_handle(&self) -> u32 {
902                    _rt::Resource::take_handle(&self.handle)
903                }
904                #[doc(hidden)]
905                pub fn handle(&self) -> u32 {
906                    _rt::Resource::handle(&self.handle)
907                }
908            }
909            unsafe impl _rt::WasmResource for FutureIncomingResponse {
910                #[inline]
911                unsafe fn drop(_handle: u32) {
912                    #[cfg(target_arch = "wasm32")]
913                    #[link(wasm_import_module = "wasi:http/types@0.2.4")]
914                    unsafe extern "C" {
915                        #[link_name = "[resource-drop]future-incoming-response"]
916                        fn drop(_: i32);
917                    }
918                    #[cfg(not(target_arch = "wasm32"))]
919                    unsafe extern "C" fn drop(_: i32) {
920                        unreachable!()
921                    }
922                    unsafe {
923                        drop(_handle as i32);
924                    }
925                }
926            }
927            #[allow(unused_unsafe, clippy::all)]
928            /// Attempts to extract a http-related `error` from the wasi:io `error`
929            /// provided.
930            ///
931            /// Stream operations which return
932            /// `wasi:io/stream/stream-error::last-operation-failed` have a payload of
933            /// type `wasi:io/error/error` with more information about the operation
934            /// that failed. This payload can be passed through to this function to see
935            /// if there's http-related information about the error to return.
936            ///
937            /// Note that this function is fallible because not all io-errors are
938            /// http-related errors.
939            #[allow(async_fn_in_trait)]
940            pub fn http_error_code(err: &IoError) -> Option<ErrorCode> {
941                unsafe {
942                    #[repr(align(8))]
943                    struct RetArea(
944                        [::core::mem::MaybeUninit<
945                            u8,
946                        >; 24 + 4 * ::core::mem::size_of::<*const u8>()],
947                    );
948                    let mut ret_area = RetArea(
949                        [::core::mem::MaybeUninit::uninit(); 24
950                            + 4 * ::core::mem::size_of::<*const u8>()],
951                    );
952                    let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
953                    #[cfg(target_arch = "wasm32")]
954                    #[link(wasm_import_module = "wasi:http/types@0.2.4")]
955                    unsafe extern "C" {
956                        #[link_name = "http-error-code"]
957                        fn wit_import1(_: i32, _: *mut u8);
958                    }
959                    #[cfg(not(target_arch = "wasm32"))]
960                    unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
961                        unreachable!()
962                    }
963                    wit_import1((err).handle() as i32, ptr0);
964                    let l2 = i32::from(*ptr0.add(0).cast::<u8>());
965                    let result66 = match l2 {
966                        0 => None,
967                        1 => {
968                            let e = {
969                                let l3 = i32::from(*ptr0.add(8).cast::<u8>());
970                                let v65 = match l3 {
971                                    0 => ErrorCode::DnsTimeout,
972                                    1 => {
973                                        let e65 = {
974                                            let l4 = i32::from(*ptr0.add(16).cast::<u8>());
975                                            let l8 = i32::from(
976                                                *ptr0
977                                                    .add(16 + 3 * ::core::mem::size_of::<*const u8>())
978                                                    .cast::<u8>(),
979                                            );
980                                            DnsErrorPayload {
981                                                rcode: match l4 {
982                                                    0 => None,
983                                                    1 => {
984                                                        let e = {
985                                                            let l5 = *ptr0
986                                                                .add(16 + 1 * ::core::mem::size_of::<*const u8>())
987                                                                .cast::<*mut u8>();
988                                                            let l6 = *ptr0
989                                                                .add(16 + 2 * ::core::mem::size_of::<*const u8>())
990                                                                .cast::<usize>();
991                                                            let len7 = l6;
992                                                            let bytes7 = _rt::Vec::from_raw_parts(
993                                                                l5.cast(),
994                                                                len7,
995                                                                len7,
996                                                            );
997                                                            _rt::string_lift(bytes7)
998                                                        };
999                                                        Some(e)
1000                                                    }
1001                                                    _ => _rt::invalid_enum_discriminant(),
1002                                                },
1003                                                info_code: match l8 {
1004                                                    0 => None,
1005                                                    1 => {
1006                                                        let e = {
1007                                                            let l9 = i32::from(
1008                                                                *ptr0
1009                                                                    .add(18 + 3 * ::core::mem::size_of::<*const u8>())
1010                                                                    .cast::<u16>(),
1011                                                            );
1012                                                            l9 as u16
1013                                                        };
1014                                                        Some(e)
1015                                                    }
1016                                                    _ => _rt::invalid_enum_discriminant(),
1017                                                },
1018                                            }
1019                                        };
1020                                        ErrorCode::DnsError(e65)
1021                                    }
1022                                    2 => ErrorCode::DestinationNotFound,
1023                                    3 => ErrorCode::DestinationUnavailable,
1024                                    4 => ErrorCode::DestinationIpProhibited,
1025                                    5 => ErrorCode::DestinationIpUnroutable,
1026                                    6 => ErrorCode::ConnectionRefused,
1027                                    7 => ErrorCode::ConnectionTerminated,
1028                                    8 => ErrorCode::ConnectionTimeout,
1029                                    9 => ErrorCode::ConnectionReadTimeout,
1030                                    10 => ErrorCode::ConnectionWriteTimeout,
1031                                    11 => ErrorCode::ConnectionLimitReached,
1032                                    12 => ErrorCode::TlsProtocolError,
1033                                    13 => ErrorCode::TlsCertificateError,
1034                                    14 => {
1035                                        let e65 = {
1036                                            let l10 = i32::from(*ptr0.add(16).cast::<u8>());
1037                                            let l12 = i32::from(
1038                                                *ptr0
1039                                                    .add(16 + 1 * ::core::mem::size_of::<*const u8>())
1040                                                    .cast::<u8>(),
1041                                            );
1042                                            TlsAlertReceivedPayload {
1043                                                alert_id: match l10 {
1044                                                    0 => None,
1045                                                    1 => {
1046                                                        let e = {
1047                                                            let l11 = i32::from(*ptr0.add(17).cast::<u8>());
1048                                                            l11 as u8
1049                                                        };
1050                                                        Some(e)
1051                                                    }
1052                                                    _ => _rt::invalid_enum_discriminant(),
1053                                                },
1054                                                alert_message: match l12 {
1055                                                    0 => None,
1056                                                    1 => {
1057                                                        let e = {
1058                                                            let l13 = *ptr0
1059                                                                .add(16 + 2 * ::core::mem::size_of::<*const u8>())
1060                                                                .cast::<*mut u8>();
1061                                                            let l14 = *ptr0
1062                                                                .add(16 + 3 * ::core::mem::size_of::<*const u8>())
1063                                                                .cast::<usize>();
1064                                                            let len15 = l14;
1065                                                            let bytes15 = _rt::Vec::from_raw_parts(
1066                                                                l13.cast(),
1067                                                                len15,
1068                                                                len15,
1069                                                            );
1070                                                            _rt::string_lift(bytes15)
1071                                                        };
1072                                                        Some(e)
1073                                                    }
1074                                                    _ => _rt::invalid_enum_discriminant(),
1075                                                },
1076                                            }
1077                                        };
1078                                        ErrorCode::TlsAlertReceived(e65)
1079                                    }
1080                                    15 => ErrorCode::HttpRequestDenied,
1081                                    16 => ErrorCode::HttpRequestLengthRequired,
1082                                    17 => {
1083                                        let e65 = {
1084                                            let l16 = i32::from(*ptr0.add(16).cast::<u8>());
1085                                            match l16 {
1086                                                0 => None,
1087                                                1 => {
1088                                                    let e = {
1089                                                        let l17 = *ptr0.add(24).cast::<i64>();
1090                                                        l17 as u64
1091                                                    };
1092                                                    Some(e)
1093                                                }
1094                                                _ => _rt::invalid_enum_discriminant(),
1095                                            }
1096                                        };
1097                                        ErrorCode::HttpRequestBodySize(e65)
1098                                    }
1099                                    18 => ErrorCode::HttpRequestMethodInvalid,
1100                                    19 => ErrorCode::HttpRequestUriInvalid,
1101                                    20 => ErrorCode::HttpRequestUriTooLong,
1102                                    21 => {
1103                                        let e65 = {
1104                                            let l18 = i32::from(*ptr0.add(16).cast::<u8>());
1105                                            match l18 {
1106                                                0 => None,
1107                                                1 => {
1108                                                    let e = {
1109                                                        let l19 = *ptr0.add(20).cast::<i32>();
1110                                                        l19 as u32
1111                                                    };
1112                                                    Some(e)
1113                                                }
1114                                                _ => _rt::invalid_enum_discriminant(),
1115                                            }
1116                                        };
1117                                        ErrorCode::HttpRequestHeaderSectionSize(e65)
1118                                    }
1119                                    22 => {
1120                                        let e65 = {
1121                                            let l20 = i32::from(*ptr0.add(16).cast::<u8>());
1122                                            match l20 {
1123                                                0 => None,
1124                                                1 => {
1125                                                    let e = {
1126                                                        let l21 = i32::from(
1127                                                            *ptr0
1128                                                                .add(16 + 1 * ::core::mem::size_of::<*const u8>())
1129                                                                .cast::<u8>(),
1130                                                        );
1131                                                        let l25 = i32::from(
1132                                                            *ptr0
1133                                                                .add(16 + 4 * ::core::mem::size_of::<*const u8>())
1134                                                                .cast::<u8>(),
1135                                                        );
1136                                                        FieldSizePayload {
1137                                                            field_name: match l21 {
1138                                                                0 => None,
1139                                                                1 => {
1140                                                                    let e = {
1141                                                                        let l22 = *ptr0
1142                                                                            .add(16 + 2 * ::core::mem::size_of::<*const u8>())
1143                                                                            .cast::<*mut u8>();
1144                                                                        let l23 = *ptr0
1145                                                                            .add(16 + 3 * ::core::mem::size_of::<*const u8>())
1146                                                                            .cast::<usize>();
1147                                                                        let len24 = l23;
1148                                                                        let bytes24 = _rt::Vec::from_raw_parts(
1149                                                                            l22.cast(),
1150                                                                            len24,
1151                                                                            len24,
1152                                                                        );
1153                                                                        _rt::string_lift(bytes24)
1154                                                                    };
1155                                                                    Some(e)
1156                                                                }
1157                                                                _ => _rt::invalid_enum_discriminant(),
1158                                                            },
1159                                                            field_size: match l25 {
1160                                                                0 => None,
1161                                                                1 => {
1162                                                                    let e = {
1163                                                                        let l26 = *ptr0
1164                                                                            .add(20 + 4 * ::core::mem::size_of::<*const u8>())
1165                                                                            .cast::<i32>();
1166                                                                        l26 as u32
1167                                                                    };
1168                                                                    Some(e)
1169                                                                }
1170                                                                _ => _rt::invalid_enum_discriminant(),
1171                                                            },
1172                                                        }
1173                                                    };
1174                                                    Some(e)
1175                                                }
1176                                                _ => _rt::invalid_enum_discriminant(),
1177                                            }
1178                                        };
1179                                        ErrorCode::HttpRequestHeaderSize(e65)
1180                                    }
1181                                    23 => {
1182                                        let e65 = {
1183                                            let l27 = i32::from(*ptr0.add(16).cast::<u8>());
1184                                            match l27 {
1185                                                0 => None,
1186                                                1 => {
1187                                                    let e = {
1188                                                        let l28 = *ptr0.add(20).cast::<i32>();
1189                                                        l28 as u32
1190                                                    };
1191                                                    Some(e)
1192                                                }
1193                                                _ => _rt::invalid_enum_discriminant(),
1194                                            }
1195                                        };
1196                                        ErrorCode::HttpRequestTrailerSectionSize(e65)
1197                                    }
1198                                    24 => {
1199                                        let e65 = {
1200                                            let l29 = i32::from(*ptr0.add(16).cast::<u8>());
1201                                            let l33 = i32::from(
1202                                                *ptr0
1203                                                    .add(16 + 3 * ::core::mem::size_of::<*const u8>())
1204                                                    .cast::<u8>(),
1205                                            );
1206                                            FieldSizePayload {
1207                                                field_name: match l29 {
1208                                                    0 => None,
1209                                                    1 => {
1210                                                        let e = {
1211                                                            let l30 = *ptr0
1212                                                                .add(16 + 1 * ::core::mem::size_of::<*const u8>())
1213                                                                .cast::<*mut u8>();
1214                                                            let l31 = *ptr0
1215                                                                .add(16 + 2 * ::core::mem::size_of::<*const u8>())
1216                                                                .cast::<usize>();
1217                                                            let len32 = l31;
1218                                                            let bytes32 = _rt::Vec::from_raw_parts(
1219                                                                l30.cast(),
1220                                                                len32,
1221                                                                len32,
1222                                                            );
1223                                                            _rt::string_lift(bytes32)
1224                                                        };
1225                                                        Some(e)
1226                                                    }
1227                                                    _ => _rt::invalid_enum_discriminant(),
1228                                                },
1229                                                field_size: match l33 {
1230                                                    0 => None,
1231                                                    1 => {
1232                                                        let e = {
1233                                                            let l34 = *ptr0
1234                                                                .add(20 + 3 * ::core::mem::size_of::<*const u8>())
1235                                                                .cast::<i32>();
1236                                                            l34 as u32
1237                                                        };
1238                                                        Some(e)
1239                                                    }
1240                                                    _ => _rt::invalid_enum_discriminant(),
1241                                                },
1242                                            }
1243                                        };
1244                                        ErrorCode::HttpRequestTrailerSize(e65)
1245                                    }
1246                                    25 => ErrorCode::HttpResponseIncomplete,
1247                                    26 => {
1248                                        let e65 = {
1249                                            let l35 = i32::from(*ptr0.add(16).cast::<u8>());
1250                                            match l35 {
1251                                                0 => None,
1252                                                1 => {
1253                                                    let e = {
1254                                                        let l36 = *ptr0.add(20).cast::<i32>();
1255                                                        l36 as u32
1256                                                    };
1257                                                    Some(e)
1258                                                }
1259                                                _ => _rt::invalid_enum_discriminant(),
1260                                            }
1261                                        };
1262                                        ErrorCode::HttpResponseHeaderSectionSize(e65)
1263                                    }
1264                                    27 => {
1265                                        let e65 = {
1266                                            let l37 = i32::from(*ptr0.add(16).cast::<u8>());
1267                                            let l41 = i32::from(
1268                                                *ptr0
1269                                                    .add(16 + 3 * ::core::mem::size_of::<*const u8>())
1270                                                    .cast::<u8>(),
1271                                            );
1272                                            FieldSizePayload {
1273                                                field_name: match l37 {
1274                                                    0 => None,
1275                                                    1 => {
1276                                                        let e = {
1277                                                            let l38 = *ptr0
1278                                                                .add(16 + 1 * ::core::mem::size_of::<*const u8>())
1279                                                                .cast::<*mut u8>();
1280                                                            let l39 = *ptr0
1281                                                                .add(16 + 2 * ::core::mem::size_of::<*const u8>())
1282                                                                .cast::<usize>();
1283                                                            let len40 = l39;
1284                                                            let bytes40 = _rt::Vec::from_raw_parts(
1285                                                                l38.cast(),
1286                                                                len40,
1287                                                                len40,
1288                                                            );
1289                                                            _rt::string_lift(bytes40)
1290                                                        };
1291                                                        Some(e)
1292                                                    }
1293                                                    _ => _rt::invalid_enum_discriminant(),
1294                                                },
1295                                                field_size: match l41 {
1296                                                    0 => None,
1297                                                    1 => {
1298                                                        let e = {
1299                                                            let l42 = *ptr0
1300                                                                .add(20 + 3 * ::core::mem::size_of::<*const u8>())
1301                                                                .cast::<i32>();
1302                                                            l42 as u32
1303                                                        };
1304                                                        Some(e)
1305                                                    }
1306                                                    _ => _rt::invalid_enum_discriminant(),
1307                                                },
1308                                            }
1309                                        };
1310                                        ErrorCode::HttpResponseHeaderSize(e65)
1311                                    }
1312                                    28 => {
1313                                        let e65 = {
1314                                            let l43 = i32::from(*ptr0.add(16).cast::<u8>());
1315                                            match l43 {
1316                                                0 => None,
1317                                                1 => {
1318                                                    let e = {
1319                                                        let l44 = *ptr0.add(24).cast::<i64>();
1320                                                        l44 as u64
1321                                                    };
1322                                                    Some(e)
1323                                                }
1324                                                _ => _rt::invalid_enum_discriminant(),
1325                                            }
1326                                        };
1327                                        ErrorCode::HttpResponseBodySize(e65)
1328                                    }
1329                                    29 => {
1330                                        let e65 = {
1331                                            let l45 = i32::from(*ptr0.add(16).cast::<u8>());
1332                                            match l45 {
1333                                                0 => None,
1334                                                1 => {
1335                                                    let e = {
1336                                                        let l46 = *ptr0.add(20).cast::<i32>();
1337                                                        l46 as u32
1338                                                    };
1339                                                    Some(e)
1340                                                }
1341                                                _ => _rt::invalid_enum_discriminant(),
1342                                            }
1343                                        };
1344                                        ErrorCode::HttpResponseTrailerSectionSize(e65)
1345                                    }
1346                                    30 => {
1347                                        let e65 = {
1348                                            let l47 = i32::from(*ptr0.add(16).cast::<u8>());
1349                                            let l51 = i32::from(
1350                                                *ptr0
1351                                                    .add(16 + 3 * ::core::mem::size_of::<*const u8>())
1352                                                    .cast::<u8>(),
1353                                            );
1354                                            FieldSizePayload {
1355                                                field_name: match l47 {
1356                                                    0 => None,
1357                                                    1 => {
1358                                                        let e = {
1359                                                            let l48 = *ptr0
1360                                                                .add(16 + 1 * ::core::mem::size_of::<*const u8>())
1361                                                                .cast::<*mut u8>();
1362                                                            let l49 = *ptr0
1363                                                                .add(16 + 2 * ::core::mem::size_of::<*const u8>())
1364                                                                .cast::<usize>();
1365                                                            let len50 = l49;
1366                                                            let bytes50 = _rt::Vec::from_raw_parts(
1367                                                                l48.cast(),
1368                                                                len50,
1369                                                                len50,
1370                                                            );
1371                                                            _rt::string_lift(bytes50)
1372                                                        };
1373                                                        Some(e)
1374                                                    }
1375                                                    _ => _rt::invalid_enum_discriminant(),
1376                                                },
1377                                                field_size: match l51 {
1378                                                    0 => None,
1379                                                    1 => {
1380                                                        let e = {
1381                                                            let l52 = *ptr0
1382                                                                .add(20 + 3 * ::core::mem::size_of::<*const u8>())
1383                                                                .cast::<i32>();
1384                                                            l52 as u32
1385                                                        };
1386                                                        Some(e)
1387                                                    }
1388                                                    _ => _rt::invalid_enum_discriminant(),
1389                                                },
1390                                            }
1391                                        };
1392                                        ErrorCode::HttpResponseTrailerSize(e65)
1393                                    }
1394                                    31 => {
1395                                        let e65 = {
1396                                            let l53 = i32::from(*ptr0.add(16).cast::<u8>());
1397                                            match l53 {
1398                                                0 => None,
1399                                                1 => {
1400                                                    let e = {
1401                                                        let l54 = *ptr0
1402                                                            .add(16 + 1 * ::core::mem::size_of::<*const u8>())
1403                                                            .cast::<*mut u8>();
1404                                                        let l55 = *ptr0
1405                                                            .add(16 + 2 * ::core::mem::size_of::<*const u8>())
1406                                                            .cast::<usize>();
1407                                                        let len56 = l55;
1408                                                        let bytes56 = _rt::Vec::from_raw_parts(
1409                                                            l54.cast(),
1410                                                            len56,
1411                                                            len56,
1412                                                        );
1413                                                        _rt::string_lift(bytes56)
1414                                                    };
1415                                                    Some(e)
1416                                                }
1417                                                _ => _rt::invalid_enum_discriminant(),
1418                                            }
1419                                        };
1420                                        ErrorCode::HttpResponseTransferCoding(e65)
1421                                    }
1422                                    32 => {
1423                                        let e65 = {
1424                                            let l57 = i32::from(*ptr0.add(16).cast::<u8>());
1425                                            match l57 {
1426                                                0 => None,
1427                                                1 => {
1428                                                    let e = {
1429                                                        let l58 = *ptr0
1430                                                            .add(16 + 1 * ::core::mem::size_of::<*const u8>())
1431                                                            .cast::<*mut u8>();
1432                                                        let l59 = *ptr0
1433                                                            .add(16 + 2 * ::core::mem::size_of::<*const u8>())
1434                                                            .cast::<usize>();
1435                                                        let len60 = l59;
1436                                                        let bytes60 = _rt::Vec::from_raw_parts(
1437                                                            l58.cast(),
1438                                                            len60,
1439                                                            len60,
1440                                                        );
1441                                                        _rt::string_lift(bytes60)
1442                                                    };
1443                                                    Some(e)
1444                                                }
1445                                                _ => _rt::invalid_enum_discriminant(),
1446                                            }
1447                                        };
1448                                        ErrorCode::HttpResponseContentCoding(e65)
1449                                    }
1450                                    33 => ErrorCode::HttpResponseTimeout,
1451                                    34 => ErrorCode::HttpUpgradeFailed,
1452                                    35 => ErrorCode::HttpProtocolError,
1453                                    36 => ErrorCode::LoopDetected,
1454                                    37 => ErrorCode::ConfigurationError,
1455                                    n => {
1456                                        debug_assert_eq!(n, 38, "invalid enum discriminant");
1457                                        let e65 = {
1458                                            let l61 = i32::from(*ptr0.add(16).cast::<u8>());
1459                                            match l61 {
1460                                                0 => None,
1461                                                1 => {
1462                                                    let e = {
1463                                                        let l62 = *ptr0
1464                                                            .add(16 + 1 * ::core::mem::size_of::<*const u8>())
1465                                                            .cast::<*mut u8>();
1466                                                        let l63 = *ptr0
1467                                                            .add(16 + 2 * ::core::mem::size_of::<*const u8>())
1468                                                            .cast::<usize>();
1469                                                        let len64 = l63;
1470                                                        let bytes64 = _rt::Vec::from_raw_parts(
1471                                                            l62.cast(),
1472                                                            len64,
1473                                                            len64,
1474                                                        );
1475                                                        _rt::string_lift(bytes64)
1476                                                    };
1477                                                    Some(e)
1478                                                }
1479                                                _ => _rt::invalid_enum_discriminant(),
1480                                            }
1481                                        };
1482                                        ErrorCode::InternalError(e65)
1483                                    }
1484                                };
1485                                v65
1486                            };
1487                            Some(e)
1488                        }
1489                        _ => _rt::invalid_enum_discriminant(),
1490                    };
1491                    result66
1492                }
1493            }
1494            impl Fields {
1495                #[allow(unused_unsafe, clippy::all)]
1496                /// Construct an empty HTTP Fields.
1497                ///
1498                /// The resulting `fields` is mutable.
1499                #[allow(async_fn_in_trait)]
1500                pub fn new() -> Self {
1501                    unsafe {
1502                        #[cfg(target_arch = "wasm32")]
1503                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
1504                        unsafe extern "C" {
1505                            #[link_name = "[constructor]fields"]
1506                            fn wit_import0() -> i32;
1507                        }
1508                        #[cfg(not(target_arch = "wasm32"))]
1509                        unsafe extern "C" fn wit_import0() -> i32 {
1510                            unreachable!()
1511                        }
1512                        let ret = wit_import0();
1513                        Fields::from_handle(ret as u32)
1514                    }
1515                }
1516            }
1517            impl Fields {
1518                #[allow(unused_unsafe, clippy::all)]
1519                /// Construct an HTTP Fields.
1520                ///
1521                /// The resulting `fields` is mutable.
1522                ///
1523                /// The list represents each name-value pair in the Fields. Names
1524                /// which have multiple values are represented by multiple entries in this
1525                /// list with the same name.
1526                ///
1527                /// The tuple is a pair of the field name, represented as a string, and
1528                /// Value, represented as a list of bytes.
1529                ///
1530                /// An error result will be returned if any `field-name` or `field-value` is
1531                /// syntactically invalid, or if a field is forbidden.
1532                #[allow(async_fn_in_trait)]
1533                pub fn from_list(
1534                    entries: &[(FieldName, FieldValue)],
1535                ) -> Result<Fields, HeaderError> {
1536                    unsafe {
1537                        #[repr(align(4))]
1538                        struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
1539                        let mut ret_area = RetArea(
1540                            [::core::mem::MaybeUninit::uninit(); 8],
1541                        );
1542                        let vec3 = entries;
1543                        let len3 = vec3.len();
1544                        let layout3 = _rt::alloc::Layout::from_size_align(
1545                                vec3.len() * (4 * ::core::mem::size_of::<*const u8>()),
1546                                ::core::mem::size_of::<*const u8>(),
1547                            )
1548                            .unwrap();
1549                        let (result3, _cleanup3) = wit_bindgen::rt::Cleanup::new(
1550                            layout3,
1551                        );
1552                        for (i, e) in vec3.into_iter().enumerate() {
1553                            let base = result3
1554                                .add(i * (4 * ::core::mem::size_of::<*const u8>()));
1555                            {
1556                                let (t0_0, t0_1) = e;
1557                                let vec1 = t0_0;
1558                                let ptr1 = vec1.as_ptr().cast::<u8>();
1559                                let len1 = vec1.len();
1560                                *base
1561                                    .add(::core::mem::size_of::<*const u8>())
1562                                    .cast::<usize>() = len1;
1563                                *base.add(0).cast::<*mut u8>() = ptr1.cast_mut();
1564                                let vec2 = t0_1;
1565                                let ptr2 = vec2.as_ptr().cast::<u8>();
1566                                let len2 = vec2.len();
1567                                *base
1568                                    .add(3 * ::core::mem::size_of::<*const u8>())
1569                                    .cast::<usize>() = len2;
1570                                *base
1571                                    .add(2 * ::core::mem::size_of::<*const u8>())
1572                                    .cast::<*mut u8>() = ptr2.cast_mut();
1573                            }
1574                        }
1575                        let ptr4 = ret_area.0.as_mut_ptr().cast::<u8>();
1576                        #[cfg(target_arch = "wasm32")]
1577                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
1578                        unsafe extern "C" {
1579                            #[link_name = "[static]fields.from-list"]
1580                            fn wit_import5(_: *mut u8, _: usize, _: *mut u8);
1581                        }
1582                        #[cfg(not(target_arch = "wasm32"))]
1583                        unsafe extern "C" fn wit_import5(
1584                            _: *mut u8,
1585                            _: usize,
1586                            _: *mut u8,
1587                        ) {
1588                            unreachable!()
1589                        }
1590                        wit_import5(result3, len3, ptr4);
1591                        let l6 = i32::from(*ptr4.add(0).cast::<u8>());
1592                        let result10 = match l6 {
1593                            0 => {
1594                                let e = {
1595                                    let l7 = *ptr4.add(4).cast::<i32>();
1596                                    Fields::from_handle(l7 as u32)
1597                                };
1598                                Ok(e)
1599                            }
1600                            1 => {
1601                                let e = {
1602                                    let l8 = i32::from(*ptr4.add(4).cast::<u8>());
1603                                    let v9 = match l8 {
1604                                        0 => HeaderError::InvalidSyntax,
1605                                        1 => HeaderError::Forbidden,
1606                                        n => {
1607                                            debug_assert_eq!(n, 2, "invalid enum discriminant");
1608                                            HeaderError::Immutable
1609                                        }
1610                                    };
1611                                    v9
1612                                };
1613                                Err(e)
1614                            }
1615                            _ => _rt::invalid_enum_discriminant(),
1616                        };
1617                        result10
1618                    }
1619                }
1620            }
1621            impl Fields {
1622                #[allow(unused_unsafe, clippy::all)]
1623                /// Get all of the values corresponding to a name. If the name is not present
1624                /// in this `fields` or is syntactically invalid, an empty list is returned.
1625                /// However, if the name is present but empty, this is represented by a list
1626                /// with one or more empty field-values present.
1627                #[allow(async_fn_in_trait)]
1628                pub fn get(&self, name: &str) -> _rt::Vec<FieldValue> {
1629                    unsafe {
1630                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
1631                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
1632                        struct RetArea(
1633                            [::core::mem::MaybeUninit<
1634                                u8,
1635                            >; 2 * ::core::mem::size_of::<*const u8>()],
1636                        );
1637                        let mut ret_area = RetArea(
1638                            [::core::mem::MaybeUninit::uninit(); 2
1639                                * ::core::mem::size_of::<*const u8>()],
1640                        );
1641                        let vec0 = name;
1642                        let ptr0 = vec0.as_ptr().cast::<u8>();
1643                        let len0 = vec0.len();
1644                        let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
1645                        #[cfg(target_arch = "wasm32")]
1646                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
1647                        unsafe extern "C" {
1648                            #[link_name = "[method]fields.get"]
1649                            fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8);
1650                        }
1651                        #[cfg(not(target_arch = "wasm32"))]
1652                        unsafe extern "C" fn wit_import2(
1653                            _: i32,
1654                            _: *mut u8,
1655                            _: usize,
1656                            _: *mut u8,
1657                        ) {
1658                            unreachable!()
1659                        }
1660                        wit_import2((self).handle() as i32, ptr0.cast_mut(), len0, ptr1);
1661                        let l3 = *ptr1.add(0).cast::<*mut u8>();
1662                        let l4 = *ptr1
1663                            .add(::core::mem::size_of::<*const u8>())
1664                            .cast::<usize>();
1665                        let base8 = l3;
1666                        let len8 = l4;
1667                        let mut result8 = _rt::Vec::with_capacity(len8);
1668                        for i in 0..len8 {
1669                            let base = base8
1670                                .add(i * (2 * ::core::mem::size_of::<*const u8>()));
1671                            let e8 = {
1672                                let l5 = *base.add(0).cast::<*mut u8>();
1673                                let l6 = *base
1674                                    .add(::core::mem::size_of::<*const u8>())
1675                                    .cast::<usize>();
1676                                let len7 = l6;
1677                                _rt::Vec::from_raw_parts(l5.cast(), len7, len7)
1678                            };
1679                            result8.push(e8);
1680                        }
1681                        _rt::cabi_dealloc(
1682                            base8,
1683                            len8 * (2 * ::core::mem::size_of::<*const u8>()),
1684                            ::core::mem::size_of::<*const u8>(),
1685                        );
1686                        let result9 = result8;
1687                        result9
1688                    }
1689                }
1690            }
1691            impl Fields {
1692                #[allow(unused_unsafe, clippy::all)]
1693                /// Returns `true` when the name is present in this `fields`. If the name is
1694                /// syntactically invalid, `false` is returned.
1695                #[allow(async_fn_in_trait)]
1696                pub fn has(&self, name: &str) -> bool {
1697                    unsafe {
1698                        let vec0 = name;
1699                        let ptr0 = vec0.as_ptr().cast::<u8>();
1700                        let len0 = vec0.len();
1701                        #[cfg(target_arch = "wasm32")]
1702                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
1703                        unsafe extern "C" {
1704                            #[link_name = "[method]fields.has"]
1705                            fn wit_import1(_: i32, _: *mut u8, _: usize) -> i32;
1706                        }
1707                        #[cfg(not(target_arch = "wasm32"))]
1708                        unsafe extern "C" fn wit_import1(
1709                            _: i32,
1710                            _: *mut u8,
1711                            _: usize,
1712                        ) -> i32 {
1713                            unreachable!()
1714                        }
1715                        let ret = wit_import1(
1716                            (self).handle() as i32,
1717                            ptr0.cast_mut(),
1718                            len0,
1719                        );
1720                        _rt::bool_lift(ret as u8)
1721                    }
1722                }
1723            }
1724            impl Fields {
1725                #[allow(unused_unsafe, clippy::all)]
1726                /// Set all of the values for a name. Clears any existing values for that
1727                /// name, if they have been set.
1728                ///
1729                /// Fails with `header-error.immutable` if the `fields` are immutable.
1730                ///
1731                /// Fails with `header-error.invalid-syntax` if the `field-name` or any of
1732                /// the `field-value`s are syntactically invalid.
1733                #[allow(async_fn_in_trait)]
1734                pub fn set(
1735                    &self,
1736                    name: &str,
1737                    value: &[FieldValue],
1738                ) -> Result<(), HeaderError> {
1739                    unsafe {
1740                        #[repr(align(1))]
1741                        struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
1742                        let mut ret_area = RetArea(
1743                            [::core::mem::MaybeUninit::uninit(); 2],
1744                        );
1745                        let vec0 = name;
1746                        let ptr0 = vec0.as_ptr().cast::<u8>();
1747                        let len0 = vec0.len();
1748                        let vec2 = value;
1749                        let len2 = vec2.len();
1750                        let layout2 = _rt::alloc::Layout::from_size_align(
1751                                vec2.len() * (2 * ::core::mem::size_of::<*const u8>()),
1752                                ::core::mem::size_of::<*const u8>(),
1753                            )
1754                            .unwrap();
1755                        let (result2, _cleanup2) = wit_bindgen::rt::Cleanup::new(
1756                            layout2,
1757                        );
1758                        for (i, e) in vec2.into_iter().enumerate() {
1759                            let base = result2
1760                                .add(i * (2 * ::core::mem::size_of::<*const u8>()));
1761                            {
1762                                let vec1 = e;
1763                                let ptr1 = vec1.as_ptr().cast::<u8>();
1764                                let len1 = vec1.len();
1765                                *base
1766                                    .add(::core::mem::size_of::<*const u8>())
1767                                    .cast::<usize>() = len1;
1768                                *base.add(0).cast::<*mut u8>() = ptr1.cast_mut();
1769                            }
1770                        }
1771                        let ptr3 = ret_area.0.as_mut_ptr().cast::<u8>();
1772                        #[cfg(target_arch = "wasm32")]
1773                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
1774                        unsafe extern "C" {
1775                            #[link_name = "[method]fields.set"]
1776                            fn wit_import4(
1777                                _: i32,
1778                                _: *mut u8,
1779                                _: usize,
1780                                _: *mut u8,
1781                                _: usize,
1782                                _: *mut u8,
1783                            );
1784                        }
1785                        #[cfg(not(target_arch = "wasm32"))]
1786                        unsafe extern "C" fn wit_import4(
1787                            _: i32,
1788                            _: *mut u8,
1789                            _: usize,
1790                            _: *mut u8,
1791                            _: usize,
1792                            _: *mut u8,
1793                        ) {
1794                            unreachable!()
1795                        }
1796                        wit_import4(
1797                            (self).handle() as i32,
1798                            ptr0.cast_mut(),
1799                            len0,
1800                            result2,
1801                            len2,
1802                            ptr3,
1803                        );
1804                        let l5 = i32::from(*ptr3.add(0).cast::<u8>());
1805                        let result8 = match l5 {
1806                            0 => {
1807                                let e = ();
1808                                Ok(e)
1809                            }
1810                            1 => {
1811                                let e = {
1812                                    let l6 = i32::from(*ptr3.add(1).cast::<u8>());
1813                                    let v7 = match l6 {
1814                                        0 => HeaderError::InvalidSyntax,
1815                                        1 => HeaderError::Forbidden,
1816                                        n => {
1817                                            debug_assert_eq!(n, 2, "invalid enum discriminant");
1818                                            HeaderError::Immutable
1819                                        }
1820                                    };
1821                                    v7
1822                                };
1823                                Err(e)
1824                            }
1825                            _ => _rt::invalid_enum_discriminant(),
1826                        };
1827                        result8
1828                    }
1829                }
1830            }
1831            impl Fields {
1832                #[allow(unused_unsafe, clippy::all)]
1833                /// Delete all values for a name. Does nothing if no values for the name
1834                /// exist.
1835                ///
1836                /// Fails with `header-error.immutable` if the `fields` are immutable.
1837                ///
1838                /// Fails with `header-error.invalid-syntax` if the `field-name` is
1839                /// syntactically invalid.
1840                #[allow(async_fn_in_trait)]
1841                pub fn delete(&self, name: &str) -> Result<(), HeaderError> {
1842                    unsafe {
1843                        #[repr(align(1))]
1844                        struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
1845                        let mut ret_area = RetArea(
1846                            [::core::mem::MaybeUninit::uninit(); 2],
1847                        );
1848                        let vec0 = name;
1849                        let ptr0 = vec0.as_ptr().cast::<u8>();
1850                        let len0 = vec0.len();
1851                        let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
1852                        #[cfg(target_arch = "wasm32")]
1853                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
1854                        unsafe extern "C" {
1855                            #[link_name = "[method]fields.delete"]
1856                            fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8);
1857                        }
1858                        #[cfg(not(target_arch = "wasm32"))]
1859                        unsafe extern "C" fn wit_import2(
1860                            _: i32,
1861                            _: *mut u8,
1862                            _: usize,
1863                            _: *mut u8,
1864                        ) {
1865                            unreachable!()
1866                        }
1867                        wit_import2((self).handle() as i32, ptr0.cast_mut(), len0, ptr1);
1868                        let l3 = i32::from(*ptr1.add(0).cast::<u8>());
1869                        let result6 = match l3 {
1870                            0 => {
1871                                let e = ();
1872                                Ok(e)
1873                            }
1874                            1 => {
1875                                let e = {
1876                                    let l4 = i32::from(*ptr1.add(1).cast::<u8>());
1877                                    let v5 = match l4 {
1878                                        0 => HeaderError::InvalidSyntax,
1879                                        1 => HeaderError::Forbidden,
1880                                        n => {
1881                                            debug_assert_eq!(n, 2, "invalid enum discriminant");
1882                                            HeaderError::Immutable
1883                                        }
1884                                    };
1885                                    v5
1886                                };
1887                                Err(e)
1888                            }
1889                            _ => _rt::invalid_enum_discriminant(),
1890                        };
1891                        result6
1892                    }
1893                }
1894            }
1895            impl Fields {
1896                #[allow(unused_unsafe, clippy::all)]
1897                /// Append a value for a name. Does not change or delete any existing
1898                /// values for that name.
1899                ///
1900                /// Fails with `header-error.immutable` if the `fields` are immutable.
1901                ///
1902                /// Fails with `header-error.invalid-syntax` if the `field-name` or
1903                /// `field-value` are syntactically invalid.
1904                #[allow(async_fn_in_trait)]
1905                pub fn append(
1906                    &self,
1907                    name: &str,
1908                    value: &[u8],
1909                ) -> Result<(), HeaderError> {
1910                    unsafe {
1911                        #[repr(align(1))]
1912                        struct RetArea([::core::mem::MaybeUninit<u8>; 2]);
1913                        let mut ret_area = RetArea(
1914                            [::core::mem::MaybeUninit::uninit(); 2],
1915                        );
1916                        let vec0 = name;
1917                        let ptr0 = vec0.as_ptr().cast::<u8>();
1918                        let len0 = vec0.len();
1919                        let vec1 = value;
1920                        let ptr1 = vec1.as_ptr().cast::<u8>();
1921                        let len1 = vec1.len();
1922                        let ptr2 = ret_area.0.as_mut_ptr().cast::<u8>();
1923                        #[cfg(target_arch = "wasm32")]
1924                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
1925                        unsafe extern "C" {
1926                            #[link_name = "[method]fields.append"]
1927                            fn wit_import3(
1928                                _: i32,
1929                                _: *mut u8,
1930                                _: usize,
1931                                _: *mut u8,
1932                                _: usize,
1933                                _: *mut u8,
1934                            );
1935                        }
1936                        #[cfg(not(target_arch = "wasm32"))]
1937                        unsafe extern "C" fn wit_import3(
1938                            _: i32,
1939                            _: *mut u8,
1940                            _: usize,
1941                            _: *mut u8,
1942                            _: usize,
1943                            _: *mut u8,
1944                        ) {
1945                            unreachable!()
1946                        }
1947                        wit_import3(
1948                            (self).handle() as i32,
1949                            ptr0.cast_mut(),
1950                            len0,
1951                            ptr1.cast_mut(),
1952                            len1,
1953                            ptr2,
1954                        );
1955                        let l4 = i32::from(*ptr2.add(0).cast::<u8>());
1956                        let result7 = match l4 {
1957                            0 => {
1958                                let e = ();
1959                                Ok(e)
1960                            }
1961                            1 => {
1962                                let e = {
1963                                    let l5 = i32::from(*ptr2.add(1).cast::<u8>());
1964                                    let v6 = match l5 {
1965                                        0 => HeaderError::InvalidSyntax,
1966                                        1 => HeaderError::Forbidden,
1967                                        n => {
1968                                            debug_assert_eq!(n, 2, "invalid enum discriminant");
1969                                            HeaderError::Immutable
1970                                        }
1971                                    };
1972                                    v6
1973                                };
1974                                Err(e)
1975                            }
1976                            _ => _rt::invalid_enum_discriminant(),
1977                        };
1978                        result7
1979                    }
1980                }
1981            }
1982            impl Fields {
1983                #[allow(unused_unsafe, clippy::all)]
1984                /// Retrieve the full set of names and values in the Fields. Like the
1985                /// constructor, the list represents each name-value pair.
1986                ///
1987                /// The outer list represents each name-value pair in the Fields. Names
1988                /// which have multiple values are represented by multiple entries in this
1989                /// list with the same name.
1990                ///
1991                /// The names and values are always returned in the original casing and in
1992                /// the order in which they will be serialized for transport.
1993                #[allow(async_fn_in_trait)]
1994                pub fn entries(&self) -> _rt::Vec<(FieldName, FieldValue)> {
1995                    unsafe {
1996                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
1997                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
1998                        struct RetArea(
1999                            [::core::mem::MaybeUninit<
2000                                u8,
2001                            >; 2 * ::core::mem::size_of::<*const u8>()],
2002                        );
2003                        let mut ret_area = RetArea(
2004                            [::core::mem::MaybeUninit::uninit(); 2
2005                                * ::core::mem::size_of::<*const u8>()],
2006                        );
2007                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
2008                        #[cfg(target_arch = "wasm32")]
2009                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2010                        unsafe extern "C" {
2011                            #[link_name = "[method]fields.entries"]
2012                            fn wit_import1(_: i32, _: *mut u8);
2013                        }
2014                        #[cfg(not(target_arch = "wasm32"))]
2015                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
2016                            unreachable!()
2017                        }
2018                        wit_import1((self).handle() as i32, ptr0);
2019                        let l2 = *ptr0.add(0).cast::<*mut u8>();
2020                        let l3 = *ptr0
2021                            .add(::core::mem::size_of::<*const u8>())
2022                            .cast::<usize>();
2023                        let base10 = l2;
2024                        let len10 = l3;
2025                        let mut result10 = _rt::Vec::with_capacity(len10);
2026                        for i in 0..len10 {
2027                            let base = base10
2028                                .add(i * (4 * ::core::mem::size_of::<*const u8>()));
2029                            let e10 = {
2030                                let l4 = *base.add(0).cast::<*mut u8>();
2031                                let l5 = *base
2032                                    .add(::core::mem::size_of::<*const u8>())
2033                                    .cast::<usize>();
2034                                let len6 = l5;
2035                                let bytes6 = _rt::Vec::from_raw_parts(
2036                                    l4.cast(),
2037                                    len6,
2038                                    len6,
2039                                );
2040                                let l7 = *base
2041                                    .add(2 * ::core::mem::size_of::<*const u8>())
2042                                    .cast::<*mut u8>();
2043                                let l8 = *base
2044                                    .add(3 * ::core::mem::size_of::<*const u8>())
2045                                    .cast::<usize>();
2046                                let len9 = l8;
2047                                (
2048                                    _rt::string_lift(bytes6),
2049                                    _rt::Vec::from_raw_parts(l7.cast(), len9, len9),
2050                                )
2051                            };
2052                            result10.push(e10);
2053                        }
2054                        _rt::cabi_dealloc(
2055                            base10,
2056                            len10 * (4 * ::core::mem::size_of::<*const u8>()),
2057                            ::core::mem::size_of::<*const u8>(),
2058                        );
2059                        let result11 = result10;
2060                        result11
2061                    }
2062                }
2063            }
2064            impl Fields {
2065                #[allow(unused_unsafe, clippy::all)]
2066                /// Make a deep copy of the Fields. Equivalent in behavior to calling the
2067                /// `fields` constructor on the return value of `entries`. The resulting
2068                /// `fields` is mutable.
2069                #[allow(async_fn_in_trait)]
2070                pub fn clone(&self) -> Fields {
2071                    unsafe {
2072                        #[cfg(target_arch = "wasm32")]
2073                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2074                        unsafe extern "C" {
2075                            #[link_name = "[method]fields.clone"]
2076                            fn wit_import0(_: i32) -> i32;
2077                        }
2078                        #[cfg(not(target_arch = "wasm32"))]
2079                        unsafe extern "C" fn wit_import0(_: i32) -> i32 {
2080                            unreachable!()
2081                        }
2082                        let ret = wit_import0((self).handle() as i32);
2083                        Fields::from_handle(ret as u32)
2084                    }
2085                }
2086            }
2087            impl IncomingRequest {
2088                #[allow(unused_unsafe, clippy::all)]
2089                /// Returns the method of the incoming request.
2090                #[allow(async_fn_in_trait)]
2091                pub fn method(&self) -> Method {
2092                    unsafe {
2093                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
2094                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
2095                        struct RetArea(
2096                            [::core::mem::MaybeUninit<
2097                                u8,
2098                            >; 3 * ::core::mem::size_of::<*const u8>()],
2099                        );
2100                        let mut ret_area = RetArea(
2101                            [::core::mem::MaybeUninit::uninit(); 3
2102                                * ::core::mem::size_of::<*const u8>()],
2103                        );
2104                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
2105                        #[cfg(target_arch = "wasm32")]
2106                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2107                        unsafe extern "C" {
2108                            #[link_name = "[method]incoming-request.method"]
2109                            fn wit_import1(_: i32, _: *mut u8);
2110                        }
2111                        #[cfg(not(target_arch = "wasm32"))]
2112                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
2113                            unreachable!()
2114                        }
2115                        wit_import1((self).handle() as i32, ptr0);
2116                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
2117                        let v6 = match l2 {
2118                            0 => Method::Get,
2119                            1 => Method::Head,
2120                            2 => Method::Post,
2121                            3 => Method::Put,
2122                            4 => Method::Delete,
2123                            5 => Method::Connect,
2124                            6 => Method::Options,
2125                            7 => Method::Trace,
2126                            8 => Method::Patch,
2127                            n => {
2128                                debug_assert_eq!(n, 9, "invalid enum discriminant");
2129                                let e6 = {
2130                                    let l3 = *ptr0
2131                                        .add(::core::mem::size_of::<*const u8>())
2132                                        .cast::<*mut u8>();
2133                                    let l4 = *ptr0
2134                                        .add(2 * ::core::mem::size_of::<*const u8>())
2135                                        .cast::<usize>();
2136                                    let len5 = l4;
2137                                    let bytes5 = _rt::Vec::from_raw_parts(
2138                                        l3.cast(),
2139                                        len5,
2140                                        len5,
2141                                    );
2142                                    _rt::string_lift(bytes5)
2143                                };
2144                                Method::Other(e6)
2145                            }
2146                        };
2147                        let result7 = v6;
2148                        result7
2149                    }
2150                }
2151            }
2152            impl IncomingRequest {
2153                #[allow(unused_unsafe, clippy::all)]
2154                /// Returns the path with query parameters from the request, as a string.
2155                #[allow(async_fn_in_trait)]
2156                pub fn path_with_query(&self) -> Option<_rt::String> {
2157                    unsafe {
2158                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
2159                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
2160                        struct RetArea(
2161                            [::core::mem::MaybeUninit<
2162                                u8,
2163                            >; 3 * ::core::mem::size_of::<*const u8>()],
2164                        );
2165                        let mut ret_area = RetArea(
2166                            [::core::mem::MaybeUninit::uninit(); 3
2167                                * ::core::mem::size_of::<*const u8>()],
2168                        );
2169                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
2170                        #[cfg(target_arch = "wasm32")]
2171                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2172                        unsafe extern "C" {
2173                            #[link_name = "[method]incoming-request.path-with-query"]
2174                            fn wit_import1(_: i32, _: *mut u8);
2175                        }
2176                        #[cfg(not(target_arch = "wasm32"))]
2177                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
2178                            unreachable!()
2179                        }
2180                        wit_import1((self).handle() as i32, ptr0);
2181                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
2182                        let result6 = match l2 {
2183                            0 => None,
2184                            1 => {
2185                                let e = {
2186                                    let l3 = *ptr0
2187                                        .add(::core::mem::size_of::<*const u8>())
2188                                        .cast::<*mut u8>();
2189                                    let l4 = *ptr0
2190                                        .add(2 * ::core::mem::size_of::<*const u8>())
2191                                        .cast::<usize>();
2192                                    let len5 = l4;
2193                                    let bytes5 = _rt::Vec::from_raw_parts(
2194                                        l3.cast(),
2195                                        len5,
2196                                        len5,
2197                                    );
2198                                    _rt::string_lift(bytes5)
2199                                };
2200                                Some(e)
2201                            }
2202                            _ => _rt::invalid_enum_discriminant(),
2203                        };
2204                        result6
2205                    }
2206                }
2207            }
2208            impl IncomingRequest {
2209                #[allow(unused_unsafe, clippy::all)]
2210                /// Returns the protocol scheme from the request.
2211                #[allow(async_fn_in_trait)]
2212                pub fn scheme(&self) -> Option<Scheme> {
2213                    unsafe {
2214                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
2215                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
2216                        struct RetArea(
2217                            [::core::mem::MaybeUninit<
2218                                u8,
2219                            >; 4 * ::core::mem::size_of::<*const u8>()],
2220                        );
2221                        let mut ret_area = RetArea(
2222                            [::core::mem::MaybeUninit::uninit(); 4
2223                                * ::core::mem::size_of::<*const u8>()],
2224                        );
2225                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
2226                        #[cfg(target_arch = "wasm32")]
2227                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2228                        unsafe extern "C" {
2229                            #[link_name = "[method]incoming-request.scheme"]
2230                            fn wit_import1(_: i32, _: *mut u8);
2231                        }
2232                        #[cfg(not(target_arch = "wasm32"))]
2233                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
2234                            unreachable!()
2235                        }
2236                        wit_import1((self).handle() as i32, ptr0);
2237                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
2238                        let result8 = match l2 {
2239                            0 => None,
2240                            1 => {
2241                                let e = {
2242                                    let l3 = i32::from(
2243                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
2244                                    );
2245                                    let v7 = match l3 {
2246                                        0 => Scheme::Http,
2247                                        1 => Scheme::Https,
2248                                        n => {
2249                                            debug_assert_eq!(n, 2, "invalid enum discriminant");
2250                                            let e7 = {
2251                                                let l4 = *ptr0
2252                                                    .add(2 * ::core::mem::size_of::<*const u8>())
2253                                                    .cast::<*mut u8>();
2254                                                let l5 = *ptr0
2255                                                    .add(3 * ::core::mem::size_of::<*const u8>())
2256                                                    .cast::<usize>();
2257                                                let len6 = l5;
2258                                                let bytes6 = _rt::Vec::from_raw_parts(
2259                                                    l4.cast(),
2260                                                    len6,
2261                                                    len6,
2262                                                );
2263                                                _rt::string_lift(bytes6)
2264                                            };
2265                                            Scheme::Other(e7)
2266                                        }
2267                                    };
2268                                    v7
2269                                };
2270                                Some(e)
2271                            }
2272                            _ => _rt::invalid_enum_discriminant(),
2273                        };
2274                        result8
2275                    }
2276                }
2277            }
2278            impl IncomingRequest {
2279                #[allow(unused_unsafe, clippy::all)]
2280                /// Returns the authority of the Request's target URI, if present.
2281                #[allow(async_fn_in_trait)]
2282                pub fn authority(&self) -> Option<_rt::String> {
2283                    unsafe {
2284                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
2285                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
2286                        struct RetArea(
2287                            [::core::mem::MaybeUninit<
2288                                u8,
2289                            >; 3 * ::core::mem::size_of::<*const u8>()],
2290                        );
2291                        let mut ret_area = RetArea(
2292                            [::core::mem::MaybeUninit::uninit(); 3
2293                                * ::core::mem::size_of::<*const u8>()],
2294                        );
2295                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
2296                        #[cfg(target_arch = "wasm32")]
2297                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2298                        unsafe extern "C" {
2299                            #[link_name = "[method]incoming-request.authority"]
2300                            fn wit_import1(_: i32, _: *mut u8);
2301                        }
2302                        #[cfg(not(target_arch = "wasm32"))]
2303                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
2304                            unreachable!()
2305                        }
2306                        wit_import1((self).handle() as i32, ptr0);
2307                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
2308                        let result6 = match l2 {
2309                            0 => None,
2310                            1 => {
2311                                let e = {
2312                                    let l3 = *ptr0
2313                                        .add(::core::mem::size_of::<*const u8>())
2314                                        .cast::<*mut u8>();
2315                                    let l4 = *ptr0
2316                                        .add(2 * ::core::mem::size_of::<*const u8>())
2317                                        .cast::<usize>();
2318                                    let len5 = l4;
2319                                    let bytes5 = _rt::Vec::from_raw_parts(
2320                                        l3.cast(),
2321                                        len5,
2322                                        len5,
2323                                    );
2324                                    _rt::string_lift(bytes5)
2325                                };
2326                                Some(e)
2327                            }
2328                            _ => _rt::invalid_enum_discriminant(),
2329                        };
2330                        result6
2331                    }
2332                }
2333            }
2334            impl IncomingRequest {
2335                #[allow(unused_unsafe, clippy::all)]
2336                /// Get the `headers` associated with the request.
2337                ///
2338                /// The returned `headers` resource is immutable: `set`, `append`, and
2339                /// `delete` operations will fail with `header-error.immutable`.
2340                ///
2341                /// The `headers` returned are a child resource: it must be dropped before
2342                /// the parent `incoming-request` is dropped. Dropping this
2343                /// `incoming-request` before all children are dropped will trap.
2344                #[allow(async_fn_in_trait)]
2345                pub fn headers(&self) -> Headers {
2346                    unsafe {
2347                        #[cfg(target_arch = "wasm32")]
2348                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2349                        unsafe extern "C" {
2350                            #[link_name = "[method]incoming-request.headers"]
2351                            fn wit_import0(_: i32) -> i32;
2352                        }
2353                        #[cfg(not(target_arch = "wasm32"))]
2354                        unsafe extern "C" fn wit_import0(_: i32) -> i32 {
2355                            unreachable!()
2356                        }
2357                        let ret = wit_import0((self).handle() as i32);
2358                        Fields::from_handle(ret as u32)
2359                    }
2360                }
2361            }
2362            impl IncomingRequest {
2363                #[allow(unused_unsafe, clippy::all)]
2364                /// Gives the `incoming-body` associated with this request. Will only
2365                /// return success at most once, and subsequent calls will return error.
2366                #[allow(async_fn_in_trait)]
2367                pub fn consume(&self) -> Result<IncomingBody, ()> {
2368                    unsafe {
2369                        #[repr(align(4))]
2370                        struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
2371                        let mut ret_area = RetArea(
2372                            [::core::mem::MaybeUninit::uninit(); 8],
2373                        );
2374                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
2375                        #[cfg(target_arch = "wasm32")]
2376                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2377                        unsafe extern "C" {
2378                            #[link_name = "[method]incoming-request.consume"]
2379                            fn wit_import1(_: i32, _: *mut u8);
2380                        }
2381                        #[cfg(not(target_arch = "wasm32"))]
2382                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
2383                            unreachable!()
2384                        }
2385                        wit_import1((self).handle() as i32, ptr0);
2386                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
2387                        let result4 = match l2 {
2388                            0 => {
2389                                let e = {
2390                                    let l3 = *ptr0.add(4).cast::<i32>();
2391                                    IncomingBody::from_handle(l3 as u32)
2392                                };
2393                                Ok(e)
2394                            }
2395                            1 => {
2396                                let e = ();
2397                                Err(e)
2398                            }
2399                            _ => _rt::invalid_enum_discriminant(),
2400                        };
2401                        result4
2402                    }
2403                }
2404            }
2405            impl OutgoingRequest {
2406                #[allow(unused_unsafe, clippy::all)]
2407                /// Construct a new `outgoing-request` with a default `method` of `GET`, and
2408                /// `none` values for `path-with-query`, `scheme`, and `authority`.
2409                ///
2410                /// * `headers` is the HTTP Headers for the Request.
2411                ///
2412                /// It is possible to construct, or manipulate with the accessor functions
2413                /// below, an `outgoing-request` with an invalid combination of `scheme`
2414                /// and `authority`, or `headers` which are not permitted to be sent.
2415                /// It is the obligation of the `outgoing-handler.handle` implementation
2416                /// to reject invalid constructions of `outgoing-request`.
2417                #[allow(async_fn_in_trait)]
2418                pub fn new(headers: Headers) -> Self {
2419                    unsafe {
2420                        #[cfg(target_arch = "wasm32")]
2421                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2422                        unsafe extern "C" {
2423                            #[link_name = "[constructor]outgoing-request"]
2424                            fn wit_import0(_: i32) -> i32;
2425                        }
2426                        #[cfg(not(target_arch = "wasm32"))]
2427                        unsafe extern "C" fn wit_import0(_: i32) -> i32 {
2428                            unreachable!()
2429                        }
2430                        let ret = wit_import0((&headers).take_handle() as i32);
2431                        OutgoingRequest::from_handle(ret as u32)
2432                    }
2433                }
2434            }
2435            impl OutgoingRequest {
2436                #[allow(unused_unsafe, clippy::all)]
2437                /// Returns the resource corresponding to the outgoing Body for this
2438                /// Request.
2439                ///
2440                /// Returns success on the first call: the `outgoing-body` resource for
2441                /// this `outgoing-request` can be retrieved at most once. Subsequent
2442                /// calls will return error.
2443                #[allow(async_fn_in_trait)]
2444                pub fn body(&self) -> Result<OutgoingBody, ()> {
2445                    unsafe {
2446                        #[repr(align(4))]
2447                        struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
2448                        let mut ret_area = RetArea(
2449                            [::core::mem::MaybeUninit::uninit(); 8],
2450                        );
2451                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
2452                        #[cfg(target_arch = "wasm32")]
2453                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2454                        unsafe extern "C" {
2455                            #[link_name = "[method]outgoing-request.body"]
2456                            fn wit_import1(_: i32, _: *mut u8);
2457                        }
2458                        #[cfg(not(target_arch = "wasm32"))]
2459                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
2460                            unreachable!()
2461                        }
2462                        wit_import1((self).handle() as i32, ptr0);
2463                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
2464                        let result4 = match l2 {
2465                            0 => {
2466                                let e = {
2467                                    let l3 = *ptr0.add(4).cast::<i32>();
2468                                    OutgoingBody::from_handle(l3 as u32)
2469                                };
2470                                Ok(e)
2471                            }
2472                            1 => {
2473                                let e = ();
2474                                Err(e)
2475                            }
2476                            _ => _rt::invalid_enum_discriminant(),
2477                        };
2478                        result4
2479                    }
2480                }
2481            }
2482            impl OutgoingRequest {
2483                #[allow(unused_unsafe, clippy::all)]
2484                /// Get the Method for the Request.
2485                #[allow(async_fn_in_trait)]
2486                pub fn method(&self) -> Method {
2487                    unsafe {
2488                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
2489                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
2490                        struct RetArea(
2491                            [::core::mem::MaybeUninit<
2492                                u8,
2493                            >; 3 * ::core::mem::size_of::<*const u8>()],
2494                        );
2495                        let mut ret_area = RetArea(
2496                            [::core::mem::MaybeUninit::uninit(); 3
2497                                * ::core::mem::size_of::<*const u8>()],
2498                        );
2499                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
2500                        #[cfg(target_arch = "wasm32")]
2501                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2502                        unsafe extern "C" {
2503                            #[link_name = "[method]outgoing-request.method"]
2504                            fn wit_import1(_: i32, _: *mut u8);
2505                        }
2506                        #[cfg(not(target_arch = "wasm32"))]
2507                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
2508                            unreachable!()
2509                        }
2510                        wit_import1((self).handle() as i32, ptr0);
2511                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
2512                        let v6 = match l2 {
2513                            0 => Method::Get,
2514                            1 => Method::Head,
2515                            2 => Method::Post,
2516                            3 => Method::Put,
2517                            4 => Method::Delete,
2518                            5 => Method::Connect,
2519                            6 => Method::Options,
2520                            7 => Method::Trace,
2521                            8 => Method::Patch,
2522                            n => {
2523                                debug_assert_eq!(n, 9, "invalid enum discriminant");
2524                                let e6 = {
2525                                    let l3 = *ptr0
2526                                        .add(::core::mem::size_of::<*const u8>())
2527                                        .cast::<*mut u8>();
2528                                    let l4 = *ptr0
2529                                        .add(2 * ::core::mem::size_of::<*const u8>())
2530                                        .cast::<usize>();
2531                                    let len5 = l4;
2532                                    let bytes5 = _rt::Vec::from_raw_parts(
2533                                        l3.cast(),
2534                                        len5,
2535                                        len5,
2536                                    );
2537                                    _rt::string_lift(bytes5)
2538                                };
2539                                Method::Other(e6)
2540                            }
2541                        };
2542                        let result7 = v6;
2543                        result7
2544                    }
2545                }
2546            }
2547            impl OutgoingRequest {
2548                #[allow(unused_unsafe, clippy::all)]
2549                /// Set the Method for the Request. Fails if the string present in a
2550                /// `method.other` argument is not a syntactically valid method.
2551                #[allow(async_fn_in_trait)]
2552                pub fn set_method(&self, method: &Method) -> Result<(), ()> {
2553                    unsafe {
2554                        let (result1_0, result1_1, result1_2) = match method {
2555                            Method::Get => (0i32, ::core::ptr::null_mut(), 0usize),
2556                            Method::Head => (1i32, ::core::ptr::null_mut(), 0usize),
2557                            Method::Post => (2i32, ::core::ptr::null_mut(), 0usize),
2558                            Method::Put => (3i32, ::core::ptr::null_mut(), 0usize),
2559                            Method::Delete => (4i32, ::core::ptr::null_mut(), 0usize),
2560                            Method::Connect => (5i32, ::core::ptr::null_mut(), 0usize),
2561                            Method::Options => (6i32, ::core::ptr::null_mut(), 0usize),
2562                            Method::Trace => (7i32, ::core::ptr::null_mut(), 0usize),
2563                            Method::Patch => (8i32, ::core::ptr::null_mut(), 0usize),
2564                            Method::Other(e) => {
2565                                let vec0 = e;
2566                                let ptr0 = vec0.as_ptr().cast::<u8>();
2567                                let len0 = vec0.len();
2568                                (9i32, ptr0.cast_mut(), len0)
2569                            }
2570                        };
2571                        #[cfg(target_arch = "wasm32")]
2572                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2573                        unsafe extern "C" {
2574                            #[link_name = "[method]outgoing-request.set-method"]
2575                            fn wit_import2(_: i32, _: i32, _: *mut u8, _: usize) -> i32;
2576                        }
2577                        #[cfg(not(target_arch = "wasm32"))]
2578                        unsafe extern "C" fn wit_import2(
2579                            _: i32,
2580                            _: i32,
2581                            _: *mut u8,
2582                            _: usize,
2583                        ) -> i32 {
2584                            unreachable!()
2585                        }
2586                        let ret = wit_import2(
2587                            (self).handle() as i32,
2588                            result1_0,
2589                            result1_1,
2590                            result1_2,
2591                        );
2592                        match ret {
2593                            0 => {
2594                                let e = ();
2595                                Ok(e)
2596                            }
2597                            1 => {
2598                                let e = ();
2599                                Err(e)
2600                            }
2601                            _ => _rt::invalid_enum_discriminant(),
2602                        }
2603                    }
2604                }
2605            }
2606            impl OutgoingRequest {
2607                #[allow(unused_unsafe, clippy::all)]
2608                /// Get the combination of the HTTP Path and Query for the Request.
2609                /// When `none`, this represents an empty Path and empty Query.
2610                #[allow(async_fn_in_trait)]
2611                pub fn path_with_query(&self) -> Option<_rt::String> {
2612                    unsafe {
2613                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
2614                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
2615                        struct RetArea(
2616                            [::core::mem::MaybeUninit<
2617                                u8,
2618                            >; 3 * ::core::mem::size_of::<*const u8>()],
2619                        );
2620                        let mut ret_area = RetArea(
2621                            [::core::mem::MaybeUninit::uninit(); 3
2622                                * ::core::mem::size_of::<*const u8>()],
2623                        );
2624                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
2625                        #[cfg(target_arch = "wasm32")]
2626                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2627                        unsafe extern "C" {
2628                            #[link_name = "[method]outgoing-request.path-with-query"]
2629                            fn wit_import1(_: i32, _: *mut u8);
2630                        }
2631                        #[cfg(not(target_arch = "wasm32"))]
2632                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
2633                            unreachable!()
2634                        }
2635                        wit_import1((self).handle() as i32, ptr0);
2636                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
2637                        let result6 = match l2 {
2638                            0 => None,
2639                            1 => {
2640                                let e = {
2641                                    let l3 = *ptr0
2642                                        .add(::core::mem::size_of::<*const u8>())
2643                                        .cast::<*mut u8>();
2644                                    let l4 = *ptr0
2645                                        .add(2 * ::core::mem::size_of::<*const u8>())
2646                                        .cast::<usize>();
2647                                    let len5 = l4;
2648                                    let bytes5 = _rt::Vec::from_raw_parts(
2649                                        l3.cast(),
2650                                        len5,
2651                                        len5,
2652                                    );
2653                                    _rt::string_lift(bytes5)
2654                                };
2655                                Some(e)
2656                            }
2657                            _ => _rt::invalid_enum_discriminant(),
2658                        };
2659                        result6
2660                    }
2661                }
2662            }
2663            impl OutgoingRequest {
2664                #[allow(unused_unsafe, clippy::all)]
2665                /// Set the combination of the HTTP Path and Query for the Request.
2666                /// When `none`, this represents an empty Path and empty Query. Fails is the
2667                /// string given is not a syntactically valid path and query uri component.
2668                #[allow(async_fn_in_trait)]
2669                pub fn set_path_with_query(
2670                    &self,
2671                    path_with_query: Option<&str>,
2672                ) -> Result<(), ()> {
2673                    unsafe {
2674                        let (result1_0, result1_1, result1_2) = match path_with_query {
2675                            Some(e) => {
2676                                let vec0 = e;
2677                                let ptr0 = vec0.as_ptr().cast::<u8>();
2678                                let len0 = vec0.len();
2679                                (1i32, ptr0.cast_mut(), len0)
2680                            }
2681                            None => (0i32, ::core::ptr::null_mut(), 0usize),
2682                        };
2683                        #[cfg(target_arch = "wasm32")]
2684                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2685                        unsafe extern "C" {
2686                            #[link_name = "[method]outgoing-request.set-path-with-query"]
2687                            fn wit_import2(_: i32, _: i32, _: *mut u8, _: usize) -> i32;
2688                        }
2689                        #[cfg(not(target_arch = "wasm32"))]
2690                        unsafe extern "C" fn wit_import2(
2691                            _: i32,
2692                            _: i32,
2693                            _: *mut u8,
2694                            _: usize,
2695                        ) -> i32 {
2696                            unreachable!()
2697                        }
2698                        let ret = wit_import2(
2699                            (self).handle() as i32,
2700                            result1_0,
2701                            result1_1,
2702                            result1_2,
2703                        );
2704                        match ret {
2705                            0 => {
2706                                let e = ();
2707                                Ok(e)
2708                            }
2709                            1 => {
2710                                let e = ();
2711                                Err(e)
2712                            }
2713                            _ => _rt::invalid_enum_discriminant(),
2714                        }
2715                    }
2716                }
2717            }
2718            impl OutgoingRequest {
2719                #[allow(unused_unsafe, clippy::all)]
2720                /// Get the HTTP Related Scheme for the Request. When `none`, the
2721                /// implementation may choose an appropriate default scheme.
2722                #[allow(async_fn_in_trait)]
2723                pub fn scheme(&self) -> Option<Scheme> {
2724                    unsafe {
2725                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
2726                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
2727                        struct RetArea(
2728                            [::core::mem::MaybeUninit<
2729                                u8,
2730                            >; 4 * ::core::mem::size_of::<*const u8>()],
2731                        );
2732                        let mut ret_area = RetArea(
2733                            [::core::mem::MaybeUninit::uninit(); 4
2734                                * ::core::mem::size_of::<*const u8>()],
2735                        );
2736                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
2737                        #[cfg(target_arch = "wasm32")]
2738                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2739                        unsafe extern "C" {
2740                            #[link_name = "[method]outgoing-request.scheme"]
2741                            fn wit_import1(_: i32, _: *mut u8);
2742                        }
2743                        #[cfg(not(target_arch = "wasm32"))]
2744                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
2745                            unreachable!()
2746                        }
2747                        wit_import1((self).handle() as i32, ptr0);
2748                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
2749                        let result8 = match l2 {
2750                            0 => None,
2751                            1 => {
2752                                let e = {
2753                                    let l3 = i32::from(
2754                                        *ptr0.add(::core::mem::size_of::<*const u8>()).cast::<u8>(),
2755                                    );
2756                                    let v7 = match l3 {
2757                                        0 => Scheme::Http,
2758                                        1 => Scheme::Https,
2759                                        n => {
2760                                            debug_assert_eq!(n, 2, "invalid enum discriminant");
2761                                            let e7 = {
2762                                                let l4 = *ptr0
2763                                                    .add(2 * ::core::mem::size_of::<*const u8>())
2764                                                    .cast::<*mut u8>();
2765                                                let l5 = *ptr0
2766                                                    .add(3 * ::core::mem::size_of::<*const u8>())
2767                                                    .cast::<usize>();
2768                                                let len6 = l5;
2769                                                let bytes6 = _rt::Vec::from_raw_parts(
2770                                                    l4.cast(),
2771                                                    len6,
2772                                                    len6,
2773                                                );
2774                                                _rt::string_lift(bytes6)
2775                                            };
2776                                            Scheme::Other(e7)
2777                                        }
2778                                    };
2779                                    v7
2780                                };
2781                                Some(e)
2782                            }
2783                            _ => _rt::invalid_enum_discriminant(),
2784                        };
2785                        result8
2786                    }
2787                }
2788            }
2789            impl OutgoingRequest {
2790                #[allow(unused_unsafe, clippy::all)]
2791                /// Set the HTTP Related Scheme for the Request. When `none`, the
2792                /// implementation may choose an appropriate default scheme. Fails if the
2793                /// string given is not a syntactically valid uri scheme.
2794                #[allow(async_fn_in_trait)]
2795                pub fn set_scheme(&self, scheme: Option<&Scheme>) -> Result<(), ()> {
2796                    unsafe {
2797                        let (result2_0, result2_1, result2_2, result2_3) = match scheme {
2798                            Some(e) => {
2799                                let (result1_0, result1_1, result1_2) = match e {
2800                                    Scheme::Http => (0i32, ::core::ptr::null_mut(), 0usize),
2801                                    Scheme::Https => (1i32, ::core::ptr::null_mut(), 0usize),
2802                                    Scheme::Other(e) => {
2803                                        let vec0 = e;
2804                                        let ptr0 = vec0.as_ptr().cast::<u8>();
2805                                        let len0 = vec0.len();
2806                                        (2i32, ptr0.cast_mut(), len0)
2807                                    }
2808                                };
2809                                (1i32, result1_0, result1_1, result1_2)
2810                            }
2811                            None => (0i32, 0i32, ::core::ptr::null_mut(), 0usize),
2812                        };
2813                        #[cfg(target_arch = "wasm32")]
2814                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2815                        unsafe extern "C" {
2816                            #[link_name = "[method]outgoing-request.set-scheme"]
2817                            fn wit_import3(
2818                                _: i32,
2819                                _: i32,
2820                                _: i32,
2821                                _: *mut u8,
2822                                _: usize,
2823                            ) -> i32;
2824                        }
2825                        #[cfg(not(target_arch = "wasm32"))]
2826                        unsafe extern "C" fn wit_import3(
2827                            _: i32,
2828                            _: i32,
2829                            _: i32,
2830                            _: *mut u8,
2831                            _: usize,
2832                        ) -> i32 {
2833                            unreachable!()
2834                        }
2835                        let ret = wit_import3(
2836                            (self).handle() as i32,
2837                            result2_0,
2838                            result2_1,
2839                            result2_2,
2840                            result2_3,
2841                        );
2842                        match ret {
2843                            0 => {
2844                                let e = ();
2845                                Ok(e)
2846                            }
2847                            1 => {
2848                                let e = ();
2849                                Err(e)
2850                            }
2851                            _ => _rt::invalid_enum_discriminant(),
2852                        }
2853                    }
2854                }
2855            }
2856            impl OutgoingRequest {
2857                #[allow(unused_unsafe, clippy::all)]
2858                /// Get the authority of the Request's target URI. A value of `none` may be used
2859                /// with Related Schemes which do not require an authority. The HTTP and
2860                /// HTTPS schemes always require an authority.
2861                #[allow(async_fn_in_trait)]
2862                pub fn authority(&self) -> Option<_rt::String> {
2863                    unsafe {
2864                        #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
2865                        #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
2866                        struct RetArea(
2867                            [::core::mem::MaybeUninit<
2868                                u8,
2869                            >; 3 * ::core::mem::size_of::<*const u8>()],
2870                        );
2871                        let mut ret_area = RetArea(
2872                            [::core::mem::MaybeUninit::uninit(); 3
2873                                * ::core::mem::size_of::<*const u8>()],
2874                        );
2875                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
2876                        #[cfg(target_arch = "wasm32")]
2877                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2878                        unsafe extern "C" {
2879                            #[link_name = "[method]outgoing-request.authority"]
2880                            fn wit_import1(_: i32, _: *mut u8);
2881                        }
2882                        #[cfg(not(target_arch = "wasm32"))]
2883                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
2884                            unreachable!()
2885                        }
2886                        wit_import1((self).handle() as i32, ptr0);
2887                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
2888                        let result6 = match l2 {
2889                            0 => None,
2890                            1 => {
2891                                let e = {
2892                                    let l3 = *ptr0
2893                                        .add(::core::mem::size_of::<*const u8>())
2894                                        .cast::<*mut u8>();
2895                                    let l4 = *ptr0
2896                                        .add(2 * ::core::mem::size_of::<*const u8>())
2897                                        .cast::<usize>();
2898                                    let len5 = l4;
2899                                    let bytes5 = _rt::Vec::from_raw_parts(
2900                                        l3.cast(),
2901                                        len5,
2902                                        len5,
2903                                    );
2904                                    _rt::string_lift(bytes5)
2905                                };
2906                                Some(e)
2907                            }
2908                            _ => _rt::invalid_enum_discriminant(),
2909                        };
2910                        result6
2911                    }
2912                }
2913            }
2914            impl OutgoingRequest {
2915                #[allow(unused_unsafe, clippy::all)]
2916                /// Set the authority of the Request's target URI. A value of `none` may be used
2917                /// with Related Schemes which do not require an authority. The HTTP and
2918                /// HTTPS schemes always require an authority. Fails if the string given is
2919                /// not a syntactically valid URI authority.
2920                #[allow(async_fn_in_trait)]
2921                pub fn set_authority(&self, authority: Option<&str>) -> Result<(), ()> {
2922                    unsafe {
2923                        let (result1_0, result1_1, result1_2) = match authority {
2924                            Some(e) => {
2925                                let vec0 = e;
2926                                let ptr0 = vec0.as_ptr().cast::<u8>();
2927                                let len0 = vec0.len();
2928                                (1i32, ptr0.cast_mut(), len0)
2929                            }
2930                            None => (0i32, ::core::ptr::null_mut(), 0usize),
2931                        };
2932                        #[cfg(target_arch = "wasm32")]
2933                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2934                        unsafe extern "C" {
2935                            #[link_name = "[method]outgoing-request.set-authority"]
2936                            fn wit_import2(_: i32, _: i32, _: *mut u8, _: usize) -> i32;
2937                        }
2938                        #[cfg(not(target_arch = "wasm32"))]
2939                        unsafe extern "C" fn wit_import2(
2940                            _: i32,
2941                            _: i32,
2942                            _: *mut u8,
2943                            _: usize,
2944                        ) -> i32 {
2945                            unreachable!()
2946                        }
2947                        let ret = wit_import2(
2948                            (self).handle() as i32,
2949                            result1_0,
2950                            result1_1,
2951                            result1_2,
2952                        );
2953                        match ret {
2954                            0 => {
2955                                let e = ();
2956                                Ok(e)
2957                            }
2958                            1 => {
2959                                let e = ();
2960                                Err(e)
2961                            }
2962                            _ => _rt::invalid_enum_discriminant(),
2963                        }
2964                    }
2965                }
2966            }
2967            impl OutgoingRequest {
2968                #[allow(unused_unsafe, clippy::all)]
2969                /// Get the headers associated with the Request.
2970                ///
2971                /// The returned `headers` resource is immutable: `set`, `append`, and
2972                /// `delete` operations will fail with `header-error.immutable`.
2973                ///
2974                /// This headers resource is a child: it must be dropped before the parent
2975                /// `outgoing-request` is dropped, or its ownership is transferred to
2976                /// another component by e.g. `outgoing-handler.handle`.
2977                #[allow(async_fn_in_trait)]
2978                pub fn headers(&self) -> Headers {
2979                    unsafe {
2980                        #[cfg(target_arch = "wasm32")]
2981                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
2982                        unsafe extern "C" {
2983                            #[link_name = "[method]outgoing-request.headers"]
2984                            fn wit_import0(_: i32) -> i32;
2985                        }
2986                        #[cfg(not(target_arch = "wasm32"))]
2987                        unsafe extern "C" fn wit_import0(_: i32) -> i32 {
2988                            unreachable!()
2989                        }
2990                        let ret = wit_import0((self).handle() as i32);
2991                        Fields::from_handle(ret as u32)
2992                    }
2993                }
2994            }
2995            impl RequestOptions {
2996                #[allow(unused_unsafe, clippy::all)]
2997                /// Construct a default `request-options` value.
2998                #[allow(async_fn_in_trait)]
2999                pub fn new() -> Self {
3000                    unsafe {
3001                        #[cfg(target_arch = "wasm32")]
3002                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
3003                        unsafe extern "C" {
3004                            #[link_name = "[constructor]request-options"]
3005                            fn wit_import0() -> i32;
3006                        }
3007                        #[cfg(not(target_arch = "wasm32"))]
3008                        unsafe extern "C" fn wit_import0() -> i32 {
3009                            unreachable!()
3010                        }
3011                        let ret = wit_import0();
3012                        RequestOptions::from_handle(ret as u32)
3013                    }
3014                }
3015            }
3016            impl RequestOptions {
3017                #[allow(unused_unsafe, clippy::all)]
3018                /// The timeout for the initial connect to the HTTP Server.
3019                #[allow(async_fn_in_trait)]
3020                pub fn connect_timeout(&self) -> Option<Duration> {
3021                    unsafe {
3022                        #[repr(align(8))]
3023                        struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
3024                        let mut ret_area = RetArea(
3025                            [::core::mem::MaybeUninit::uninit(); 16],
3026                        );
3027                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
3028                        #[cfg(target_arch = "wasm32")]
3029                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
3030                        unsafe extern "C" {
3031                            #[link_name = "[method]request-options.connect-timeout"]
3032                            fn wit_import1(_: i32, _: *mut u8);
3033                        }
3034                        #[cfg(not(target_arch = "wasm32"))]
3035                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
3036                            unreachable!()
3037                        }
3038                        wit_import1((self).handle() as i32, ptr0);
3039                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
3040                        let result4 = match l2 {
3041                            0 => None,
3042                            1 => {
3043                                let e = {
3044                                    let l3 = *ptr0.add(8).cast::<i64>();
3045                                    l3 as u64
3046                                };
3047                                Some(e)
3048                            }
3049                            _ => _rt::invalid_enum_discriminant(),
3050                        };
3051                        result4
3052                    }
3053                }
3054            }
3055            impl RequestOptions {
3056                #[allow(unused_unsafe, clippy::all)]
3057                /// Set the timeout for the initial connect to the HTTP Server. An error
3058                /// return value indicates that this timeout is not supported.
3059                #[allow(async_fn_in_trait)]
3060                pub fn set_connect_timeout(
3061                    &self,
3062                    duration: Option<Duration>,
3063                ) -> Result<(), ()> {
3064                    unsafe {
3065                        let (result0_0, result0_1) = match duration {
3066                            Some(e) => (1i32, _rt::as_i64(e)),
3067                            None => (0i32, 0i64),
3068                        };
3069                        #[cfg(target_arch = "wasm32")]
3070                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
3071                        unsafe extern "C" {
3072                            #[link_name = "[method]request-options.set-connect-timeout"]
3073                            fn wit_import1(_: i32, _: i32, _: i64) -> i32;
3074                        }
3075                        #[cfg(not(target_arch = "wasm32"))]
3076                        unsafe extern "C" fn wit_import1(_: i32, _: i32, _: i64) -> i32 {
3077                            unreachable!()
3078                        }
3079                        let ret = wit_import1(
3080                            (self).handle() as i32,
3081                            result0_0,
3082                            result0_1,
3083                        );
3084                        match ret {
3085                            0 => {
3086                                let e = ();
3087                                Ok(e)
3088                            }
3089                            1 => {
3090                                let e = ();
3091                                Err(e)
3092                            }
3093                            _ => _rt::invalid_enum_discriminant(),
3094                        }
3095                    }
3096                }
3097            }
3098            impl RequestOptions {
3099                #[allow(unused_unsafe, clippy::all)]
3100                /// The timeout for receiving the first byte of the Response body.
3101                #[allow(async_fn_in_trait)]
3102                pub fn first_byte_timeout(&self) -> Option<Duration> {
3103                    unsafe {
3104                        #[repr(align(8))]
3105                        struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
3106                        let mut ret_area = RetArea(
3107                            [::core::mem::MaybeUninit::uninit(); 16],
3108                        );
3109                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
3110                        #[cfg(target_arch = "wasm32")]
3111                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
3112                        unsafe extern "C" {
3113                            #[link_name = "[method]request-options.first-byte-timeout"]
3114                            fn wit_import1(_: i32, _: *mut u8);
3115                        }
3116                        #[cfg(not(target_arch = "wasm32"))]
3117                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
3118                            unreachable!()
3119                        }
3120                        wit_import1((self).handle() as i32, ptr0);
3121                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
3122                        let result4 = match l2 {
3123                            0 => None,
3124                            1 => {
3125                                let e = {
3126                                    let l3 = *ptr0.add(8).cast::<i64>();
3127                                    l3 as u64
3128                                };
3129                                Some(e)
3130                            }
3131                            _ => _rt::invalid_enum_discriminant(),
3132                        };
3133                        result4
3134                    }
3135                }
3136            }
3137            impl RequestOptions {
3138                #[allow(unused_unsafe, clippy::all)]
3139                /// Set the timeout for receiving the first byte of the Response body. An
3140                /// error return value indicates that this timeout is not supported.
3141                #[allow(async_fn_in_trait)]
3142                pub fn set_first_byte_timeout(
3143                    &self,
3144                    duration: Option<Duration>,
3145                ) -> Result<(), ()> {
3146                    unsafe {
3147                        let (result0_0, result0_1) = match duration {
3148                            Some(e) => (1i32, _rt::as_i64(e)),
3149                            None => (0i32, 0i64),
3150                        };
3151                        #[cfg(target_arch = "wasm32")]
3152                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
3153                        unsafe extern "C" {
3154                            #[link_name = "[method]request-options.set-first-byte-timeout"]
3155                            fn wit_import1(_: i32, _: i32, _: i64) -> i32;
3156                        }
3157                        #[cfg(not(target_arch = "wasm32"))]
3158                        unsafe extern "C" fn wit_import1(_: i32, _: i32, _: i64) -> i32 {
3159                            unreachable!()
3160                        }
3161                        let ret = wit_import1(
3162                            (self).handle() as i32,
3163                            result0_0,
3164                            result0_1,
3165                        );
3166                        match ret {
3167                            0 => {
3168                                let e = ();
3169                                Ok(e)
3170                            }
3171                            1 => {
3172                                let e = ();
3173                                Err(e)
3174                            }
3175                            _ => _rt::invalid_enum_discriminant(),
3176                        }
3177                    }
3178                }
3179            }
3180            impl RequestOptions {
3181                #[allow(unused_unsafe, clippy::all)]
3182                /// The timeout for receiving subsequent chunks of bytes in the Response
3183                /// body stream.
3184                #[allow(async_fn_in_trait)]
3185                pub fn between_bytes_timeout(&self) -> Option<Duration> {
3186                    unsafe {
3187                        #[repr(align(8))]
3188                        struct RetArea([::core::mem::MaybeUninit<u8>; 16]);
3189                        let mut ret_area = RetArea(
3190                            [::core::mem::MaybeUninit::uninit(); 16],
3191                        );
3192                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
3193                        #[cfg(target_arch = "wasm32")]
3194                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
3195                        unsafe extern "C" {
3196                            #[link_name = "[method]request-options.between-bytes-timeout"]
3197                            fn wit_import1(_: i32, _: *mut u8);
3198                        }
3199                        #[cfg(not(target_arch = "wasm32"))]
3200                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
3201                            unreachable!()
3202                        }
3203                        wit_import1((self).handle() as i32, ptr0);
3204                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
3205                        let result4 = match l2 {
3206                            0 => None,
3207                            1 => {
3208                                let e = {
3209                                    let l3 = *ptr0.add(8).cast::<i64>();
3210                                    l3 as u64
3211                                };
3212                                Some(e)
3213                            }
3214                            _ => _rt::invalid_enum_discriminant(),
3215                        };
3216                        result4
3217                    }
3218                }
3219            }
3220            impl RequestOptions {
3221                #[allow(unused_unsafe, clippy::all)]
3222                /// Set the timeout for receiving subsequent chunks of bytes in the Response
3223                /// body stream. An error return value indicates that this timeout is not
3224                /// supported.
3225                #[allow(async_fn_in_trait)]
3226                pub fn set_between_bytes_timeout(
3227                    &self,
3228                    duration: Option<Duration>,
3229                ) -> Result<(), ()> {
3230                    unsafe {
3231                        let (result0_0, result0_1) = match duration {
3232                            Some(e) => (1i32, _rt::as_i64(e)),
3233                            None => (0i32, 0i64),
3234                        };
3235                        #[cfg(target_arch = "wasm32")]
3236                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
3237                        unsafe extern "C" {
3238                            #[link_name = "[method]request-options.set-between-bytes-timeout"]
3239                            fn wit_import1(_: i32, _: i32, _: i64) -> i32;
3240                        }
3241                        #[cfg(not(target_arch = "wasm32"))]
3242                        unsafe extern "C" fn wit_import1(_: i32, _: i32, _: i64) -> i32 {
3243                            unreachable!()
3244                        }
3245                        let ret = wit_import1(
3246                            (self).handle() as i32,
3247                            result0_0,
3248                            result0_1,
3249                        );
3250                        match ret {
3251                            0 => {
3252                                let e = ();
3253                                Ok(e)
3254                            }
3255                            1 => {
3256                                let e = ();
3257                                Err(e)
3258                            }
3259                            _ => _rt::invalid_enum_discriminant(),
3260                        }
3261                    }
3262                }
3263            }
3264            impl ResponseOutparam {
3265                #[allow(unused_unsafe, clippy::all)]
3266                /// Set the value of the `response-outparam` to either send a response,
3267                /// or indicate an error.
3268                ///
3269                /// This method consumes the `response-outparam` to ensure that it is
3270                /// called at most once. If it is never called, the implementation
3271                /// will respond with an error.
3272                ///
3273                /// The user may provide an `error` to `response` to allow the
3274                /// implementation determine how to respond with an HTTP error response.
3275                #[allow(async_fn_in_trait)]
3276                pub fn set(
3277                    param: ResponseOutparam,
3278                    response: Result<OutgoingResponse, ErrorCode>,
3279                ) -> () {
3280                    unsafe {
3281                        let (
3282                            result38_0,
3283                            result38_1,
3284                            result38_2,
3285                            result38_3,
3286                            result38_4,
3287                            result38_5,
3288                            result38_6,
3289                            result38_7,
3290                        ) = match &response {
3291                            Ok(e) => {
3292                                (
3293                                    0i32,
3294                                    (e).take_handle() as i32,
3295                                    0i32,
3296                                    ::core::mem::MaybeUninit::<u64>::zeroed(),
3297                                    ::core::ptr::null_mut(),
3298                                    ::core::ptr::null_mut(),
3299                                    0usize,
3300                                    0i32,
3301                                )
3302                            }
3303                            Err(e) => {
3304                                let (
3305                                    result37_0,
3306                                    result37_1,
3307                                    result37_2,
3308                                    result37_3,
3309                                    result37_4,
3310                                    result37_5,
3311                                    result37_6,
3312                                ) = match e {
3313                                    ErrorCode::DnsTimeout => {
3314                                        (
3315                                            0i32,
3316                                            0i32,
3317                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3318                                            ::core::ptr::null_mut(),
3319                                            ::core::ptr::null_mut(),
3320                                            0usize,
3321                                            0i32,
3322                                        )
3323                                    }
3324                                    ErrorCode::DnsError(e) => {
3325                                        let DnsErrorPayload {
3326                                            rcode: rcode0,
3327                                            info_code: info_code0,
3328                                        } = e;
3329                                        let (result2_0, result2_1, result2_2) = match rcode0 {
3330                                            Some(e) => {
3331                                                let vec1 = e;
3332                                                let ptr1 = vec1.as_ptr().cast::<u8>();
3333                                                let len1 = vec1.len();
3334                                                (1i32, ptr1.cast_mut(), len1)
3335                                            }
3336                                            None => (0i32, ::core::ptr::null_mut(), 0usize),
3337                                        };
3338                                        let (result3_0, result3_1) = match info_code0 {
3339                                            Some(e) => (1i32, _rt::as_i32(e)),
3340                                            None => (0i32, 0i32),
3341                                        };
3342                                        (
3343                                            1i32,
3344                                            result2_0,
3345                                            {
3346                                                let mut t = ::core::mem::MaybeUninit::<u64>::uninit();
3347                                                t.as_mut_ptr().cast::<*mut u8>().write(result2_1);
3348                                                t
3349                                            },
3350                                            result2_2 as *mut u8,
3351                                            result3_0 as *mut u8,
3352                                            result3_1 as usize,
3353                                            0i32,
3354                                        )
3355                                    }
3356                                    ErrorCode::DestinationNotFound => {
3357                                        (
3358                                            2i32,
3359                                            0i32,
3360                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3361                                            ::core::ptr::null_mut(),
3362                                            ::core::ptr::null_mut(),
3363                                            0usize,
3364                                            0i32,
3365                                        )
3366                                    }
3367                                    ErrorCode::DestinationUnavailable => {
3368                                        (
3369                                            3i32,
3370                                            0i32,
3371                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3372                                            ::core::ptr::null_mut(),
3373                                            ::core::ptr::null_mut(),
3374                                            0usize,
3375                                            0i32,
3376                                        )
3377                                    }
3378                                    ErrorCode::DestinationIpProhibited => {
3379                                        (
3380                                            4i32,
3381                                            0i32,
3382                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3383                                            ::core::ptr::null_mut(),
3384                                            ::core::ptr::null_mut(),
3385                                            0usize,
3386                                            0i32,
3387                                        )
3388                                    }
3389                                    ErrorCode::DestinationIpUnroutable => {
3390                                        (
3391                                            5i32,
3392                                            0i32,
3393                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3394                                            ::core::ptr::null_mut(),
3395                                            ::core::ptr::null_mut(),
3396                                            0usize,
3397                                            0i32,
3398                                        )
3399                                    }
3400                                    ErrorCode::ConnectionRefused => {
3401                                        (
3402                                            6i32,
3403                                            0i32,
3404                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3405                                            ::core::ptr::null_mut(),
3406                                            ::core::ptr::null_mut(),
3407                                            0usize,
3408                                            0i32,
3409                                        )
3410                                    }
3411                                    ErrorCode::ConnectionTerminated => {
3412                                        (
3413                                            7i32,
3414                                            0i32,
3415                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3416                                            ::core::ptr::null_mut(),
3417                                            ::core::ptr::null_mut(),
3418                                            0usize,
3419                                            0i32,
3420                                        )
3421                                    }
3422                                    ErrorCode::ConnectionTimeout => {
3423                                        (
3424                                            8i32,
3425                                            0i32,
3426                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3427                                            ::core::ptr::null_mut(),
3428                                            ::core::ptr::null_mut(),
3429                                            0usize,
3430                                            0i32,
3431                                        )
3432                                    }
3433                                    ErrorCode::ConnectionReadTimeout => {
3434                                        (
3435                                            9i32,
3436                                            0i32,
3437                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3438                                            ::core::ptr::null_mut(),
3439                                            ::core::ptr::null_mut(),
3440                                            0usize,
3441                                            0i32,
3442                                        )
3443                                    }
3444                                    ErrorCode::ConnectionWriteTimeout => {
3445                                        (
3446                                            10i32,
3447                                            0i32,
3448                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3449                                            ::core::ptr::null_mut(),
3450                                            ::core::ptr::null_mut(),
3451                                            0usize,
3452                                            0i32,
3453                                        )
3454                                    }
3455                                    ErrorCode::ConnectionLimitReached => {
3456                                        (
3457                                            11i32,
3458                                            0i32,
3459                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3460                                            ::core::ptr::null_mut(),
3461                                            ::core::ptr::null_mut(),
3462                                            0usize,
3463                                            0i32,
3464                                        )
3465                                    }
3466                                    ErrorCode::TlsProtocolError => {
3467                                        (
3468                                            12i32,
3469                                            0i32,
3470                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3471                                            ::core::ptr::null_mut(),
3472                                            ::core::ptr::null_mut(),
3473                                            0usize,
3474                                            0i32,
3475                                        )
3476                                    }
3477                                    ErrorCode::TlsCertificateError => {
3478                                        (
3479                                            13i32,
3480                                            0i32,
3481                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3482                                            ::core::ptr::null_mut(),
3483                                            ::core::ptr::null_mut(),
3484                                            0usize,
3485                                            0i32,
3486                                        )
3487                                    }
3488                                    ErrorCode::TlsAlertReceived(e) => {
3489                                        let TlsAlertReceivedPayload {
3490                                            alert_id: alert_id4,
3491                                            alert_message: alert_message4,
3492                                        } = e;
3493                                        let (result5_0, result5_1) = match alert_id4 {
3494                                            Some(e) => (1i32, _rt::as_i32(e)),
3495                                            None => (0i32, 0i32),
3496                                        };
3497                                        let (result7_0, result7_1, result7_2) = match alert_message4 {
3498                                            Some(e) => {
3499                                                let vec6 = e;
3500                                                let ptr6 = vec6.as_ptr().cast::<u8>();
3501                                                let len6 = vec6.len();
3502                                                (1i32, ptr6.cast_mut(), len6)
3503                                            }
3504                                            None => (0i32, ::core::ptr::null_mut(), 0usize),
3505                                        };
3506                                        (
3507                                            14i32,
3508                                            result5_0,
3509                                            ::core::mem::MaybeUninit::new(i64::from(result5_1) as u64),
3510                                            result7_0 as *mut u8,
3511                                            result7_1,
3512                                            result7_2,
3513                                            0i32,
3514                                        )
3515                                    }
3516                                    ErrorCode::HttpRequestDenied => {
3517                                        (
3518                                            15i32,
3519                                            0i32,
3520                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3521                                            ::core::ptr::null_mut(),
3522                                            ::core::ptr::null_mut(),
3523                                            0usize,
3524                                            0i32,
3525                                        )
3526                                    }
3527                                    ErrorCode::HttpRequestLengthRequired => {
3528                                        (
3529                                            16i32,
3530                                            0i32,
3531                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3532                                            ::core::ptr::null_mut(),
3533                                            ::core::ptr::null_mut(),
3534                                            0usize,
3535                                            0i32,
3536                                        )
3537                                    }
3538                                    ErrorCode::HttpRequestBodySize(e) => {
3539                                        let (result8_0, result8_1) = match e {
3540                                            Some(e) => (1i32, _rt::as_i64(e)),
3541                                            None => (0i32, 0i64),
3542                                        };
3543                                        (
3544                                            17i32,
3545                                            result8_0,
3546                                            ::core::mem::MaybeUninit::new(result8_1 as u64),
3547                                            ::core::ptr::null_mut(),
3548                                            ::core::ptr::null_mut(),
3549                                            0usize,
3550                                            0i32,
3551                                        )
3552                                    }
3553                                    ErrorCode::HttpRequestMethodInvalid => {
3554                                        (
3555                                            18i32,
3556                                            0i32,
3557                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3558                                            ::core::ptr::null_mut(),
3559                                            ::core::ptr::null_mut(),
3560                                            0usize,
3561                                            0i32,
3562                                        )
3563                                    }
3564                                    ErrorCode::HttpRequestUriInvalid => {
3565                                        (
3566                                            19i32,
3567                                            0i32,
3568                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3569                                            ::core::ptr::null_mut(),
3570                                            ::core::ptr::null_mut(),
3571                                            0usize,
3572                                            0i32,
3573                                        )
3574                                    }
3575                                    ErrorCode::HttpRequestUriTooLong => {
3576                                        (
3577                                            20i32,
3578                                            0i32,
3579                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3580                                            ::core::ptr::null_mut(),
3581                                            ::core::ptr::null_mut(),
3582                                            0usize,
3583                                            0i32,
3584                                        )
3585                                    }
3586                                    ErrorCode::HttpRequestHeaderSectionSize(e) => {
3587                                        let (result9_0, result9_1) = match e {
3588                                            Some(e) => (1i32, _rt::as_i32(e)),
3589                                            None => (0i32, 0i32),
3590                                        };
3591                                        (
3592                                            21i32,
3593                                            result9_0,
3594                                            ::core::mem::MaybeUninit::new(i64::from(result9_1) as u64),
3595                                            ::core::ptr::null_mut(),
3596                                            ::core::ptr::null_mut(),
3597                                            0usize,
3598                                            0i32,
3599                                        )
3600                                    }
3601                                    ErrorCode::HttpRequestHeaderSize(e) => {
3602                                        let (
3603                                            result14_0,
3604                                            result14_1,
3605                                            result14_2,
3606                                            result14_3,
3607                                            result14_4,
3608                                            result14_5,
3609                                        ) = match e {
3610                                            Some(e) => {
3611                                                let FieldSizePayload {
3612                                                    field_name: field_name10,
3613                                                    field_size: field_size10,
3614                                                } = e;
3615                                                let (result12_0, result12_1, result12_2) = match field_name10 {
3616                                                    Some(e) => {
3617                                                        let vec11 = e;
3618                                                        let ptr11 = vec11.as_ptr().cast::<u8>();
3619                                                        let len11 = vec11.len();
3620                                                        (1i32, ptr11.cast_mut(), len11)
3621                                                    }
3622                                                    None => (0i32, ::core::ptr::null_mut(), 0usize),
3623                                                };
3624                                                let (result13_0, result13_1) = match field_size10 {
3625                                                    Some(e) => (1i32, _rt::as_i32(e)),
3626                                                    None => (0i32, 0i32),
3627                                                };
3628                                                (
3629                                                    1i32,
3630                                                    result12_0,
3631                                                    result12_1,
3632                                                    result12_2,
3633                                                    result13_0,
3634                                                    result13_1,
3635                                                )
3636                                            }
3637                                            None => {
3638                                                (0i32, 0i32, ::core::ptr::null_mut(), 0usize, 0i32, 0i32)
3639                                            }
3640                                        };
3641                                        (
3642                                            22i32,
3643                                            result14_0,
3644                                            ::core::mem::MaybeUninit::new(i64::from(result14_1) as u64),
3645                                            result14_2,
3646                                            result14_3 as *mut u8,
3647                                            result14_4 as usize,
3648                                            result14_5,
3649                                        )
3650                                    }
3651                                    ErrorCode::HttpRequestTrailerSectionSize(e) => {
3652                                        let (result15_0, result15_1) = match e {
3653                                            Some(e) => (1i32, _rt::as_i32(e)),
3654                                            None => (0i32, 0i32),
3655                                        };
3656                                        (
3657                                            23i32,
3658                                            result15_0,
3659                                            ::core::mem::MaybeUninit::new(i64::from(result15_1) as u64),
3660                                            ::core::ptr::null_mut(),
3661                                            ::core::ptr::null_mut(),
3662                                            0usize,
3663                                            0i32,
3664                                        )
3665                                    }
3666                                    ErrorCode::HttpRequestTrailerSize(e) => {
3667                                        let FieldSizePayload {
3668                                            field_name: field_name16,
3669                                            field_size: field_size16,
3670                                        } = e;
3671                                        let (result18_0, result18_1, result18_2) = match field_name16 {
3672                                            Some(e) => {
3673                                                let vec17 = e;
3674                                                let ptr17 = vec17.as_ptr().cast::<u8>();
3675                                                let len17 = vec17.len();
3676                                                (1i32, ptr17.cast_mut(), len17)
3677                                            }
3678                                            None => (0i32, ::core::ptr::null_mut(), 0usize),
3679                                        };
3680                                        let (result19_0, result19_1) = match field_size16 {
3681                                            Some(e) => (1i32, _rt::as_i32(e)),
3682                                            None => (0i32, 0i32),
3683                                        };
3684                                        (
3685                                            24i32,
3686                                            result18_0,
3687                                            {
3688                                                let mut t = ::core::mem::MaybeUninit::<u64>::uninit();
3689                                                t.as_mut_ptr().cast::<*mut u8>().write(result18_1);
3690                                                t
3691                                            },
3692                                            result18_2 as *mut u8,
3693                                            result19_0 as *mut u8,
3694                                            result19_1 as usize,
3695                                            0i32,
3696                                        )
3697                                    }
3698                                    ErrorCode::HttpResponseIncomplete => {
3699                                        (
3700                                            25i32,
3701                                            0i32,
3702                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3703                                            ::core::ptr::null_mut(),
3704                                            ::core::ptr::null_mut(),
3705                                            0usize,
3706                                            0i32,
3707                                        )
3708                                    }
3709                                    ErrorCode::HttpResponseHeaderSectionSize(e) => {
3710                                        let (result20_0, result20_1) = match e {
3711                                            Some(e) => (1i32, _rt::as_i32(e)),
3712                                            None => (0i32, 0i32),
3713                                        };
3714                                        (
3715                                            26i32,
3716                                            result20_0,
3717                                            ::core::mem::MaybeUninit::new(i64::from(result20_1) as u64),
3718                                            ::core::ptr::null_mut(),
3719                                            ::core::ptr::null_mut(),
3720                                            0usize,
3721                                            0i32,
3722                                        )
3723                                    }
3724                                    ErrorCode::HttpResponseHeaderSize(e) => {
3725                                        let FieldSizePayload {
3726                                            field_name: field_name21,
3727                                            field_size: field_size21,
3728                                        } = e;
3729                                        let (result23_0, result23_1, result23_2) = match field_name21 {
3730                                            Some(e) => {
3731                                                let vec22 = e;
3732                                                let ptr22 = vec22.as_ptr().cast::<u8>();
3733                                                let len22 = vec22.len();
3734                                                (1i32, ptr22.cast_mut(), len22)
3735                                            }
3736                                            None => (0i32, ::core::ptr::null_mut(), 0usize),
3737                                        };
3738                                        let (result24_0, result24_1) = match field_size21 {
3739                                            Some(e) => (1i32, _rt::as_i32(e)),
3740                                            None => (0i32, 0i32),
3741                                        };
3742                                        (
3743                                            27i32,
3744                                            result23_0,
3745                                            {
3746                                                let mut t = ::core::mem::MaybeUninit::<u64>::uninit();
3747                                                t.as_mut_ptr().cast::<*mut u8>().write(result23_1);
3748                                                t
3749                                            },
3750                                            result23_2 as *mut u8,
3751                                            result24_0 as *mut u8,
3752                                            result24_1 as usize,
3753                                            0i32,
3754                                        )
3755                                    }
3756                                    ErrorCode::HttpResponseBodySize(e) => {
3757                                        let (result25_0, result25_1) = match e {
3758                                            Some(e) => (1i32, _rt::as_i64(e)),
3759                                            None => (0i32, 0i64),
3760                                        };
3761                                        (
3762                                            28i32,
3763                                            result25_0,
3764                                            ::core::mem::MaybeUninit::new(result25_1 as u64),
3765                                            ::core::ptr::null_mut(),
3766                                            ::core::ptr::null_mut(),
3767                                            0usize,
3768                                            0i32,
3769                                        )
3770                                    }
3771                                    ErrorCode::HttpResponseTrailerSectionSize(e) => {
3772                                        let (result26_0, result26_1) = match e {
3773                                            Some(e) => (1i32, _rt::as_i32(e)),
3774                                            None => (0i32, 0i32),
3775                                        };
3776                                        (
3777                                            29i32,
3778                                            result26_0,
3779                                            ::core::mem::MaybeUninit::new(i64::from(result26_1) as u64),
3780                                            ::core::ptr::null_mut(),
3781                                            ::core::ptr::null_mut(),
3782                                            0usize,
3783                                            0i32,
3784                                        )
3785                                    }
3786                                    ErrorCode::HttpResponseTrailerSize(e) => {
3787                                        let FieldSizePayload {
3788                                            field_name: field_name27,
3789                                            field_size: field_size27,
3790                                        } = e;
3791                                        let (result29_0, result29_1, result29_2) = match field_name27 {
3792                                            Some(e) => {
3793                                                let vec28 = e;
3794                                                let ptr28 = vec28.as_ptr().cast::<u8>();
3795                                                let len28 = vec28.len();
3796                                                (1i32, ptr28.cast_mut(), len28)
3797                                            }
3798                                            None => (0i32, ::core::ptr::null_mut(), 0usize),
3799                                        };
3800                                        let (result30_0, result30_1) = match field_size27 {
3801                                            Some(e) => (1i32, _rt::as_i32(e)),
3802                                            None => (0i32, 0i32),
3803                                        };
3804                                        (
3805                                            30i32,
3806                                            result29_0,
3807                                            {
3808                                                let mut t = ::core::mem::MaybeUninit::<u64>::uninit();
3809                                                t.as_mut_ptr().cast::<*mut u8>().write(result29_1);
3810                                                t
3811                                            },
3812                                            result29_2 as *mut u8,
3813                                            result30_0 as *mut u8,
3814                                            result30_1 as usize,
3815                                            0i32,
3816                                        )
3817                                    }
3818                                    ErrorCode::HttpResponseTransferCoding(e) => {
3819                                        let (result32_0, result32_1, result32_2) = match e {
3820                                            Some(e) => {
3821                                                let vec31 = e;
3822                                                let ptr31 = vec31.as_ptr().cast::<u8>();
3823                                                let len31 = vec31.len();
3824                                                (1i32, ptr31.cast_mut(), len31)
3825                                            }
3826                                            None => (0i32, ::core::ptr::null_mut(), 0usize),
3827                                        };
3828                                        (
3829                                            31i32,
3830                                            result32_0,
3831                                            {
3832                                                let mut t = ::core::mem::MaybeUninit::<u64>::uninit();
3833                                                t.as_mut_ptr().cast::<*mut u8>().write(result32_1);
3834                                                t
3835                                            },
3836                                            result32_2 as *mut u8,
3837                                            ::core::ptr::null_mut(),
3838                                            0usize,
3839                                            0i32,
3840                                        )
3841                                    }
3842                                    ErrorCode::HttpResponseContentCoding(e) => {
3843                                        let (result34_0, result34_1, result34_2) = match e {
3844                                            Some(e) => {
3845                                                let vec33 = e;
3846                                                let ptr33 = vec33.as_ptr().cast::<u8>();
3847                                                let len33 = vec33.len();
3848                                                (1i32, ptr33.cast_mut(), len33)
3849                                            }
3850                                            None => (0i32, ::core::ptr::null_mut(), 0usize),
3851                                        };
3852                                        (
3853                                            32i32,
3854                                            result34_0,
3855                                            {
3856                                                let mut t = ::core::mem::MaybeUninit::<u64>::uninit();
3857                                                t.as_mut_ptr().cast::<*mut u8>().write(result34_1);
3858                                                t
3859                                            },
3860                                            result34_2 as *mut u8,
3861                                            ::core::ptr::null_mut(),
3862                                            0usize,
3863                                            0i32,
3864                                        )
3865                                    }
3866                                    ErrorCode::HttpResponseTimeout => {
3867                                        (
3868                                            33i32,
3869                                            0i32,
3870                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3871                                            ::core::ptr::null_mut(),
3872                                            ::core::ptr::null_mut(),
3873                                            0usize,
3874                                            0i32,
3875                                        )
3876                                    }
3877                                    ErrorCode::HttpUpgradeFailed => {
3878                                        (
3879                                            34i32,
3880                                            0i32,
3881                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3882                                            ::core::ptr::null_mut(),
3883                                            ::core::ptr::null_mut(),
3884                                            0usize,
3885                                            0i32,
3886                                        )
3887                                    }
3888                                    ErrorCode::HttpProtocolError => {
3889                                        (
3890                                            35i32,
3891                                            0i32,
3892                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3893                                            ::core::ptr::null_mut(),
3894                                            ::core::ptr::null_mut(),
3895                                            0usize,
3896                                            0i32,
3897                                        )
3898                                    }
3899                                    ErrorCode::LoopDetected => {
3900                                        (
3901                                            36i32,
3902                                            0i32,
3903                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3904                                            ::core::ptr::null_mut(),
3905                                            ::core::ptr::null_mut(),
3906                                            0usize,
3907                                            0i32,
3908                                        )
3909                                    }
3910                                    ErrorCode::ConfigurationError => {
3911                                        (
3912                                            37i32,
3913                                            0i32,
3914                                            ::core::mem::MaybeUninit::<u64>::zeroed(),
3915                                            ::core::ptr::null_mut(),
3916                                            ::core::ptr::null_mut(),
3917                                            0usize,
3918                                            0i32,
3919                                        )
3920                                    }
3921                                    ErrorCode::InternalError(e) => {
3922                                        let (result36_0, result36_1, result36_2) = match e {
3923                                            Some(e) => {
3924                                                let vec35 = e;
3925                                                let ptr35 = vec35.as_ptr().cast::<u8>();
3926                                                let len35 = vec35.len();
3927                                                (1i32, ptr35.cast_mut(), len35)
3928                                            }
3929                                            None => (0i32, ::core::ptr::null_mut(), 0usize),
3930                                        };
3931                                        (
3932                                            38i32,
3933                                            result36_0,
3934                                            {
3935                                                let mut t = ::core::mem::MaybeUninit::<u64>::uninit();
3936                                                t.as_mut_ptr().cast::<*mut u8>().write(result36_1);
3937                                                t
3938                                            },
3939                                            result36_2 as *mut u8,
3940                                            ::core::ptr::null_mut(),
3941                                            0usize,
3942                                            0i32,
3943                                        )
3944                                    }
3945                                };
3946                                (
3947                                    1i32,
3948                                    result37_0,
3949                                    result37_1,
3950                                    result37_2,
3951                                    result37_3,
3952                                    result37_4,
3953                                    result37_5,
3954                                    result37_6,
3955                                )
3956                            }
3957                        };
3958                        #[cfg(target_arch = "wasm32")]
3959                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
3960                        unsafe extern "C" {
3961                            #[link_name = "[static]response-outparam.set"]
3962                            fn wit_import39(
3963                                _: i32,
3964                                _: i32,
3965                                _: i32,
3966                                _: i32,
3967                                _: ::core::mem::MaybeUninit<u64>,
3968                                _: *mut u8,
3969                                _: *mut u8,
3970                                _: usize,
3971                                _: i32,
3972                            );
3973                        }
3974                        #[cfg(not(target_arch = "wasm32"))]
3975                        unsafe extern "C" fn wit_import39(
3976                            _: i32,
3977                            _: i32,
3978                            _: i32,
3979                            _: i32,
3980                            _: ::core::mem::MaybeUninit<u64>,
3981                            _: *mut u8,
3982                            _: *mut u8,
3983                            _: usize,
3984                            _: i32,
3985                        ) {
3986                            unreachable!()
3987                        }
3988                        wit_import39(
3989                            (&param).take_handle() as i32,
3990                            result38_0,
3991                            result38_1,
3992                            result38_2,
3993                            result38_3,
3994                            result38_4,
3995                            result38_5,
3996                            result38_6,
3997                            result38_7,
3998                        );
3999                    }
4000                }
4001            }
4002            impl IncomingResponse {
4003                #[allow(unused_unsafe, clippy::all)]
4004                /// Returns the status code from the incoming response.
4005                #[allow(async_fn_in_trait)]
4006                pub fn status(&self) -> StatusCode {
4007                    unsafe {
4008                        #[cfg(target_arch = "wasm32")]
4009                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
4010                        unsafe extern "C" {
4011                            #[link_name = "[method]incoming-response.status"]
4012                            fn wit_import0(_: i32) -> i32;
4013                        }
4014                        #[cfg(not(target_arch = "wasm32"))]
4015                        unsafe extern "C" fn wit_import0(_: i32) -> i32 {
4016                            unreachable!()
4017                        }
4018                        let ret = wit_import0((self).handle() as i32);
4019                        ret as u16
4020                    }
4021                }
4022            }
4023            impl IncomingResponse {
4024                #[allow(unused_unsafe, clippy::all)]
4025                /// Returns the headers from the incoming response.
4026                ///
4027                /// The returned `headers` resource is immutable: `set`, `append`, and
4028                /// `delete` operations will fail with `header-error.immutable`.
4029                ///
4030                /// This headers resource is a child: it must be dropped before the parent
4031                /// `incoming-response` is dropped.
4032                #[allow(async_fn_in_trait)]
4033                pub fn headers(&self) -> Headers {
4034                    unsafe {
4035                        #[cfg(target_arch = "wasm32")]
4036                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
4037                        unsafe extern "C" {
4038                            #[link_name = "[method]incoming-response.headers"]
4039                            fn wit_import0(_: i32) -> i32;
4040                        }
4041                        #[cfg(not(target_arch = "wasm32"))]
4042                        unsafe extern "C" fn wit_import0(_: i32) -> i32 {
4043                            unreachable!()
4044                        }
4045                        let ret = wit_import0((self).handle() as i32);
4046                        Fields::from_handle(ret as u32)
4047                    }
4048                }
4049            }
4050            impl IncomingResponse {
4051                #[allow(unused_unsafe, clippy::all)]
4052                /// Returns the incoming body. May be called at most once. Returns error
4053                /// if called additional times.
4054                #[allow(async_fn_in_trait)]
4055                pub fn consume(&self) -> Result<IncomingBody, ()> {
4056                    unsafe {
4057                        #[repr(align(4))]
4058                        struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
4059                        let mut ret_area = RetArea(
4060                            [::core::mem::MaybeUninit::uninit(); 8],
4061                        );
4062                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
4063                        #[cfg(target_arch = "wasm32")]
4064                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
4065                        unsafe extern "C" {
4066                            #[link_name = "[method]incoming-response.consume"]
4067                            fn wit_import1(_: i32, _: *mut u8);
4068                        }
4069                        #[cfg(not(target_arch = "wasm32"))]
4070                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
4071                            unreachable!()
4072                        }
4073                        wit_import1((self).handle() as i32, ptr0);
4074                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
4075                        let result4 = match l2 {
4076                            0 => {
4077                                let e = {
4078                                    let l3 = *ptr0.add(4).cast::<i32>();
4079                                    IncomingBody::from_handle(l3 as u32)
4080                                };
4081                                Ok(e)
4082                            }
4083                            1 => {
4084                                let e = ();
4085                                Err(e)
4086                            }
4087                            _ => _rt::invalid_enum_discriminant(),
4088                        };
4089                        result4
4090                    }
4091                }
4092            }
4093            impl IncomingBody {
4094                #[allow(unused_unsafe, clippy::all)]
4095                /// Returns the contents of the body, as a stream of bytes.
4096                ///
4097                /// Returns success on first call: the stream representing the contents
4098                /// can be retrieved at most once. Subsequent calls will return error.
4099                ///
4100                /// The returned `input-stream` resource is a child: it must be dropped
4101                /// before the parent `incoming-body` is dropped, or consumed by
4102                /// `incoming-body.finish`.
4103                ///
4104                /// This invariant ensures that the implementation can determine whether
4105                /// the user is consuming the contents of the body, waiting on the
4106                /// `future-trailers` to be ready, or neither. This allows for network
4107                /// backpressure is to be applied when the user is consuming the body,
4108                /// and for that backpressure to not inhibit delivery of the trailers if
4109                /// the user does not read the entire body.
4110                #[allow(async_fn_in_trait)]
4111                pub fn stream(&self) -> Result<InputStream, ()> {
4112                    unsafe {
4113                        #[repr(align(4))]
4114                        struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
4115                        let mut ret_area = RetArea(
4116                            [::core::mem::MaybeUninit::uninit(); 8],
4117                        );
4118                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
4119                        #[cfg(target_arch = "wasm32")]
4120                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
4121                        unsafe extern "C" {
4122                            #[link_name = "[method]incoming-body.stream"]
4123                            fn wit_import1(_: i32, _: *mut u8);
4124                        }
4125                        #[cfg(not(target_arch = "wasm32"))]
4126                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
4127                            unreachable!()
4128                        }
4129                        wit_import1((self).handle() as i32, ptr0);
4130                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
4131                        let result4 = match l2 {
4132                            0 => {
4133                                let e = {
4134                                    let l3 = *ptr0.add(4).cast::<i32>();
4135                                    super::super::super::__with_name5::InputStream::from_handle(
4136                                        l3 as u32,
4137                                    )
4138                                };
4139                                Ok(e)
4140                            }
4141                            1 => {
4142                                let e = ();
4143                                Err(e)
4144                            }
4145                            _ => _rt::invalid_enum_discriminant(),
4146                        };
4147                        result4
4148                    }
4149                }
4150            }
4151            impl IncomingBody {
4152                #[allow(unused_unsafe, clippy::all)]
4153                /// Takes ownership of `incoming-body`, and returns a `future-trailers`.
4154                /// This function will trap if the `input-stream` child is still alive.
4155                #[allow(async_fn_in_trait)]
4156                pub fn finish(this: IncomingBody) -> FutureTrailers {
4157                    unsafe {
4158                        #[cfg(target_arch = "wasm32")]
4159                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
4160                        unsafe extern "C" {
4161                            #[link_name = "[static]incoming-body.finish"]
4162                            fn wit_import0(_: i32) -> i32;
4163                        }
4164                        #[cfg(not(target_arch = "wasm32"))]
4165                        unsafe extern "C" fn wit_import0(_: i32) -> i32 {
4166                            unreachable!()
4167                        }
4168                        let ret = wit_import0((&this).take_handle() as i32);
4169                        FutureTrailers::from_handle(ret as u32)
4170                    }
4171                }
4172            }
4173            impl FutureTrailers {
4174                #[allow(unused_unsafe, clippy::all)]
4175                /// Returns a pollable which becomes ready when either the trailers have
4176                /// been received, or an error has occurred. When this pollable is ready,
4177                /// the `get` method will return `some`.
4178                #[allow(async_fn_in_trait)]
4179                pub fn subscribe(&self) -> Pollable {
4180                    unsafe {
4181                        #[cfg(target_arch = "wasm32")]
4182                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
4183                        unsafe extern "C" {
4184                            #[link_name = "[method]future-trailers.subscribe"]
4185                            fn wit_import0(_: i32) -> i32;
4186                        }
4187                        #[cfg(not(target_arch = "wasm32"))]
4188                        unsafe extern "C" fn wit_import0(_: i32) -> i32 {
4189                            unreachable!()
4190                        }
4191                        let ret = wit_import0((self).handle() as i32);
4192                        super::super::super::__with_name0::Pollable::from_handle(
4193                            ret as u32,
4194                        )
4195                    }
4196                }
4197            }
4198            impl FutureTrailers {
4199                #[allow(unused_unsafe, clippy::all)]
4200                /// Returns the contents of the trailers, or an error which occurred,
4201                /// once the future is ready.
4202                ///
4203                /// The outer `option` represents future readiness. Users can wait on this
4204                /// `option` to become `some` using the `subscribe` method.
4205                ///
4206                /// The outer `result` is used to retrieve the trailers or error at most
4207                /// once. It will be success on the first call in which the outer option
4208                /// is `some`, and error on subsequent calls.
4209                ///
4210                /// The inner `result` represents that either the HTTP Request or Response
4211                /// body, as well as any trailers, were received successfully, or that an
4212                /// error occurred receiving them. The optional `trailers` indicates whether
4213                /// or not trailers were present in the body.
4214                ///
4215                /// When some `trailers` are returned by this method, the `trailers`
4216                /// resource is immutable, and a child. Use of the `set`, `append`, or
4217                /// `delete` methods will return an error, and the resource must be
4218                /// dropped before the parent `future-trailers` is dropped.
4219                #[allow(async_fn_in_trait)]
4220                pub fn get(
4221                    &self,
4222                ) -> Option<Result<Result<Option<Trailers>, ErrorCode>, ()>> {
4223                    unsafe {
4224                        #[repr(align(8))]
4225                        struct RetArea(
4226                            [::core::mem::MaybeUninit<
4227                                u8,
4228                            >; 40 + 4 * ::core::mem::size_of::<*const u8>()],
4229                        );
4230                        let mut ret_area = RetArea(
4231                            [::core::mem::MaybeUninit::uninit(); 40
4232                                + 4 * ::core::mem::size_of::<*const u8>()],
4233                        );
4234                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
4235                        #[cfg(target_arch = "wasm32")]
4236                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
4237                        unsafe extern "C" {
4238                            #[link_name = "[method]future-trailers.get"]
4239                            fn wit_import1(_: i32, _: *mut u8);
4240                        }
4241                        #[cfg(not(target_arch = "wasm32"))]
4242                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
4243                            unreachable!()
4244                        }
4245                        wit_import1((self).handle() as i32, ptr0);
4246                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
4247                        let result70 = match l2 {
4248                            0 => None,
4249                            1 => {
4250                                let e = {
4251                                    let l3 = i32::from(*ptr0.add(8).cast::<u8>());
4252                                    match l3 {
4253                                        0 => {
4254                                            let e = {
4255                                                let l4 = i32::from(*ptr0.add(16).cast::<u8>());
4256                                                match l4 {
4257                                                    0 => {
4258                                                        let e = {
4259                                                            let l5 = i32::from(*ptr0.add(24).cast::<u8>());
4260                                                            match l5 {
4261                                                                0 => None,
4262                                                                1 => {
4263                                                                    let e = {
4264                                                                        let l6 = *ptr0.add(28).cast::<i32>();
4265                                                                        Fields::from_handle(l6 as u32)
4266                                                                    };
4267                                                                    Some(e)
4268                                                                }
4269                                                                _ => _rt::invalid_enum_discriminant(),
4270                                                            }
4271                                                        };
4272                                                        Ok(e)
4273                                                    }
4274                                                    1 => {
4275                                                        let e = {
4276                                                            let l7 = i32::from(*ptr0.add(24).cast::<u8>());
4277                                                            let v69 = match l7 {
4278                                                                0 => ErrorCode::DnsTimeout,
4279                                                                1 => {
4280                                                                    let e69 = {
4281                                                                        let l8 = i32::from(*ptr0.add(32).cast::<u8>());
4282                                                                        let l12 = i32::from(
4283                                                                            *ptr0
4284                                                                                .add(32 + 3 * ::core::mem::size_of::<*const u8>())
4285                                                                                .cast::<u8>(),
4286                                                                        );
4287                                                                        DnsErrorPayload {
4288                                                                            rcode: match l8 {
4289                                                                                0 => None,
4290                                                                                1 => {
4291                                                                                    let e = {
4292                                                                                        let l9 = *ptr0
4293                                                                                            .add(32 + 1 * ::core::mem::size_of::<*const u8>())
4294                                                                                            .cast::<*mut u8>();
4295                                                                                        let l10 = *ptr0
4296                                                                                            .add(32 + 2 * ::core::mem::size_of::<*const u8>())
4297                                                                                            .cast::<usize>();
4298                                                                                        let len11 = l10;
4299                                                                                        let bytes11 = _rt::Vec::from_raw_parts(
4300                                                                                            l9.cast(),
4301                                                                                            len11,
4302                                                                                            len11,
4303                                                                                        );
4304                                                                                        _rt::string_lift(bytes11)
4305                                                                                    };
4306                                                                                    Some(e)
4307                                                                                }
4308                                                                                _ => _rt::invalid_enum_discriminant(),
4309                                                                            },
4310                                                                            info_code: match l12 {
4311                                                                                0 => None,
4312                                                                                1 => {
4313                                                                                    let e = {
4314                                                                                        let l13 = i32::from(
4315                                                                                            *ptr0
4316                                                                                                .add(34 + 3 * ::core::mem::size_of::<*const u8>())
4317                                                                                                .cast::<u16>(),
4318                                                                                        );
4319                                                                                        l13 as u16
4320                                                                                    };
4321                                                                                    Some(e)
4322                                                                                }
4323                                                                                _ => _rt::invalid_enum_discriminant(),
4324                                                                            },
4325                                                                        }
4326                                                                    };
4327                                                                    ErrorCode::DnsError(e69)
4328                                                                }
4329                                                                2 => ErrorCode::DestinationNotFound,
4330                                                                3 => ErrorCode::DestinationUnavailable,
4331                                                                4 => ErrorCode::DestinationIpProhibited,
4332                                                                5 => ErrorCode::DestinationIpUnroutable,
4333                                                                6 => ErrorCode::ConnectionRefused,
4334                                                                7 => ErrorCode::ConnectionTerminated,
4335                                                                8 => ErrorCode::ConnectionTimeout,
4336                                                                9 => ErrorCode::ConnectionReadTimeout,
4337                                                                10 => ErrorCode::ConnectionWriteTimeout,
4338                                                                11 => ErrorCode::ConnectionLimitReached,
4339                                                                12 => ErrorCode::TlsProtocolError,
4340                                                                13 => ErrorCode::TlsCertificateError,
4341                                                                14 => {
4342                                                                    let e69 = {
4343                                                                        let l14 = i32::from(*ptr0.add(32).cast::<u8>());
4344                                                                        let l16 = i32::from(
4345                                                                            *ptr0
4346                                                                                .add(32 + 1 * ::core::mem::size_of::<*const u8>())
4347                                                                                .cast::<u8>(),
4348                                                                        );
4349                                                                        TlsAlertReceivedPayload {
4350                                                                            alert_id: match l14 {
4351                                                                                0 => None,
4352                                                                                1 => {
4353                                                                                    let e = {
4354                                                                                        let l15 = i32::from(*ptr0.add(33).cast::<u8>());
4355                                                                                        l15 as u8
4356                                                                                    };
4357                                                                                    Some(e)
4358                                                                                }
4359                                                                                _ => _rt::invalid_enum_discriminant(),
4360                                                                            },
4361                                                                            alert_message: match l16 {
4362                                                                                0 => None,
4363                                                                                1 => {
4364                                                                                    let e = {
4365                                                                                        let l17 = *ptr0
4366                                                                                            .add(32 + 2 * ::core::mem::size_of::<*const u8>())
4367                                                                                            .cast::<*mut u8>();
4368                                                                                        let l18 = *ptr0
4369                                                                                            .add(32 + 3 * ::core::mem::size_of::<*const u8>())
4370                                                                                            .cast::<usize>();
4371                                                                                        let len19 = l18;
4372                                                                                        let bytes19 = _rt::Vec::from_raw_parts(
4373                                                                                            l17.cast(),
4374                                                                                            len19,
4375                                                                                            len19,
4376                                                                                        );
4377                                                                                        _rt::string_lift(bytes19)
4378                                                                                    };
4379                                                                                    Some(e)
4380                                                                                }
4381                                                                                _ => _rt::invalid_enum_discriminant(),
4382                                                                            },
4383                                                                        }
4384                                                                    };
4385                                                                    ErrorCode::TlsAlertReceived(e69)
4386                                                                }
4387                                                                15 => ErrorCode::HttpRequestDenied,
4388                                                                16 => ErrorCode::HttpRequestLengthRequired,
4389                                                                17 => {
4390                                                                    let e69 = {
4391                                                                        let l20 = i32::from(*ptr0.add(32).cast::<u8>());
4392                                                                        match l20 {
4393                                                                            0 => None,
4394                                                                            1 => {
4395                                                                                let e = {
4396                                                                                    let l21 = *ptr0.add(40).cast::<i64>();
4397                                                                                    l21 as u64
4398                                                                                };
4399                                                                                Some(e)
4400                                                                            }
4401                                                                            _ => _rt::invalid_enum_discriminant(),
4402                                                                        }
4403                                                                    };
4404                                                                    ErrorCode::HttpRequestBodySize(e69)
4405                                                                }
4406                                                                18 => ErrorCode::HttpRequestMethodInvalid,
4407                                                                19 => ErrorCode::HttpRequestUriInvalid,
4408                                                                20 => ErrorCode::HttpRequestUriTooLong,
4409                                                                21 => {
4410                                                                    let e69 = {
4411                                                                        let l22 = i32::from(*ptr0.add(32).cast::<u8>());
4412                                                                        match l22 {
4413                                                                            0 => None,
4414                                                                            1 => {
4415                                                                                let e = {
4416                                                                                    let l23 = *ptr0.add(36).cast::<i32>();
4417                                                                                    l23 as u32
4418                                                                                };
4419                                                                                Some(e)
4420                                                                            }
4421                                                                            _ => _rt::invalid_enum_discriminant(),
4422                                                                        }
4423                                                                    };
4424                                                                    ErrorCode::HttpRequestHeaderSectionSize(e69)
4425                                                                }
4426                                                                22 => {
4427                                                                    let e69 = {
4428                                                                        let l24 = i32::from(*ptr0.add(32).cast::<u8>());
4429                                                                        match l24 {
4430                                                                            0 => None,
4431                                                                            1 => {
4432                                                                                let e = {
4433                                                                                    let l25 = i32::from(
4434                                                                                        *ptr0
4435                                                                                            .add(32 + 1 * ::core::mem::size_of::<*const u8>())
4436                                                                                            .cast::<u8>(),
4437                                                                                    );
4438                                                                                    let l29 = i32::from(
4439                                                                                        *ptr0
4440                                                                                            .add(32 + 4 * ::core::mem::size_of::<*const u8>())
4441                                                                                            .cast::<u8>(),
4442                                                                                    );
4443                                                                                    FieldSizePayload {
4444                                                                                        field_name: match l25 {
4445                                                                                            0 => None,
4446                                                                                            1 => {
4447                                                                                                let e = {
4448                                                                                                    let l26 = *ptr0
4449                                                                                                        .add(32 + 2 * ::core::mem::size_of::<*const u8>())
4450                                                                                                        .cast::<*mut u8>();
4451                                                                                                    let l27 = *ptr0
4452                                                                                                        .add(32 + 3 * ::core::mem::size_of::<*const u8>())
4453                                                                                                        .cast::<usize>();
4454                                                                                                    let len28 = l27;
4455                                                                                                    let bytes28 = _rt::Vec::from_raw_parts(
4456                                                                                                        l26.cast(),
4457                                                                                                        len28,
4458                                                                                                        len28,
4459                                                                                                    );
4460                                                                                                    _rt::string_lift(bytes28)
4461                                                                                                };
4462                                                                                                Some(e)
4463                                                                                            }
4464                                                                                            _ => _rt::invalid_enum_discriminant(),
4465                                                                                        },
4466                                                                                        field_size: match l29 {
4467                                                                                            0 => None,
4468                                                                                            1 => {
4469                                                                                                let e = {
4470                                                                                                    let l30 = *ptr0
4471                                                                                                        .add(36 + 4 * ::core::mem::size_of::<*const u8>())
4472                                                                                                        .cast::<i32>();
4473                                                                                                    l30 as u32
4474                                                                                                };
4475                                                                                                Some(e)
4476                                                                                            }
4477                                                                                            _ => _rt::invalid_enum_discriminant(),
4478                                                                                        },
4479                                                                                    }
4480                                                                                };
4481                                                                                Some(e)
4482                                                                            }
4483                                                                            _ => _rt::invalid_enum_discriminant(),
4484                                                                        }
4485                                                                    };
4486                                                                    ErrorCode::HttpRequestHeaderSize(e69)
4487                                                                }
4488                                                                23 => {
4489                                                                    let e69 = {
4490                                                                        let l31 = i32::from(*ptr0.add(32).cast::<u8>());
4491                                                                        match l31 {
4492                                                                            0 => None,
4493                                                                            1 => {
4494                                                                                let e = {
4495                                                                                    let l32 = *ptr0.add(36).cast::<i32>();
4496                                                                                    l32 as u32
4497                                                                                };
4498                                                                                Some(e)
4499                                                                            }
4500                                                                            _ => _rt::invalid_enum_discriminant(),
4501                                                                        }
4502                                                                    };
4503                                                                    ErrorCode::HttpRequestTrailerSectionSize(e69)
4504                                                                }
4505                                                                24 => {
4506                                                                    let e69 = {
4507                                                                        let l33 = i32::from(*ptr0.add(32).cast::<u8>());
4508                                                                        let l37 = i32::from(
4509                                                                            *ptr0
4510                                                                                .add(32 + 3 * ::core::mem::size_of::<*const u8>())
4511                                                                                .cast::<u8>(),
4512                                                                        );
4513                                                                        FieldSizePayload {
4514                                                                            field_name: match l33 {
4515                                                                                0 => None,
4516                                                                                1 => {
4517                                                                                    let e = {
4518                                                                                        let l34 = *ptr0
4519                                                                                            .add(32 + 1 * ::core::mem::size_of::<*const u8>())
4520                                                                                            .cast::<*mut u8>();
4521                                                                                        let l35 = *ptr0
4522                                                                                            .add(32 + 2 * ::core::mem::size_of::<*const u8>())
4523                                                                                            .cast::<usize>();
4524                                                                                        let len36 = l35;
4525                                                                                        let bytes36 = _rt::Vec::from_raw_parts(
4526                                                                                            l34.cast(),
4527                                                                                            len36,
4528                                                                                            len36,
4529                                                                                        );
4530                                                                                        _rt::string_lift(bytes36)
4531                                                                                    };
4532                                                                                    Some(e)
4533                                                                                }
4534                                                                                _ => _rt::invalid_enum_discriminant(),
4535                                                                            },
4536                                                                            field_size: match l37 {
4537                                                                                0 => None,
4538                                                                                1 => {
4539                                                                                    let e = {
4540                                                                                        let l38 = *ptr0
4541                                                                                            .add(36 + 3 * ::core::mem::size_of::<*const u8>())
4542                                                                                            .cast::<i32>();
4543                                                                                        l38 as u32
4544                                                                                    };
4545                                                                                    Some(e)
4546                                                                                }
4547                                                                                _ => _rt::invalid_enum_discriminant(),
4548                                                                            },
4549                                                                        }
4550                                                                    };
4551                                                                    ErrorCode::HttpRequestTrailerSize(e69)
4552                                                                }
4553                                                                25 => ErrorCode::HttpResponseIncomplete,
4554                                                                26 => {
4555                                                                    let e69 = {
4556                                                                        let l39 = i32::from(*ptr0.add(32).cast::<u8>());
4557                                                                        match l39 {
4558                                                                            0 => None,
4559                                                                            1 => {
4560                                                                                let e = {
4561                                                                                    let l40 = *ptr0.add(36).cast::<i32>();
4562                                                                                    l40 as u32
4563                                                                                };
4564                                                                                Some(e)
4565                                                                            }
4566                                                                            _ => _rt::invalid_enum_discriminant(),
4567                                                                        }
4568                                                                    };
4569                                                                    ErrorCode::HttpResponseHeaderSectionSize(e69)
4570                                                                }
4571                                                                27 => {
4572                                                                    let e69 = {
4573                                                                        let l41 = i32::from(*ptr0.add(32).cast::<u8>());
4574                                                                        let l45 = i32::from(
4575                                                                            *ptr0
4576                                                                                .add(32 + 3 * ::core::mem::size_of::<*const u8>())
4577                                                                                .cast::<u8>(),
4578                                                                        );
4579                                                                        FieldSizePayload {
4580                                                                            field_name: match l41 {
4581                                                                                0 => None,
4582                                                                                1 => {
4583                                                                                    let e = {
4584                                                                                        let l42 = *ptr0
4585                                                                                            .add(32 + 1 * ::core::mem::size_of::<*const u8>())
4586                                                                                            .cast::<*mut u8>();
4587                                                                                        let l43 = *ptr0
4588                                                                                            .add(32 + 2 * ::core::mem::size_of::<*const u8>())
4589                                                                                            .cast::<usize>();
4590                                                                                        let len44 = l43;
4591                                                                                        let bytes44 = _rt::Vec::from_raw_parts(
4592                                                                                            l42.cast(),
4593                                                                                            len44,
4594                                                                                            len44,
4595                                                                                        );
4596                                                                                        _rt::string_lift(bytes44)
4597                                                                                    };
4598                                                                                    Some(e)
4599                                                                                }
4600                                                                                _ => _rt::invalid_enum_discriminant(),
4601                                                                            },
4602                                                                            field_size: match l45 {
4603                                                                                0 => None,
4604                                                                                1 => {
4605                                                                                    let e = {
4606                                                                                        let l46 = *ptr0
4607                                                                                            .add(36 + 3 * ::core::mem::size_of::<*const u8>())
4608                                                                                            .cast::<i32>();
4609                                                                                        l46 as u32
4610                                                                                    };
4611                                                                                    Some(e)
4612                                                                                }
4613                                                                                _ => _rt::invalid_enum_discriminant(),
4614                                                                            },
4615                                                                        }
4616                                                                    };
4617                                                                    ErrorCode::HttpResponseHeaderSize(e69)
4618                                                                }
4619                                                                28 => {
4620                                                                    let e69 = {
4621                                                                        let l47 = i32::from(*ptr0.add(32).cast::<u8>());
4622                                                                        match l47 {
4623                                                                            0 => None,
4624                                                                            1 => {
4625                                                                                let e = {
4626                                                                                    let l48 = *ptr0.add(40).cast::<i64>();
4627                                                                                    l48 as u64
4628                                                                                };
4629                                                                                Some(e)
4630                                                                            }
4631                                                                            _ => _rt::invalid_enum_discriminant(),
4632                                                                        }
4633                                                                    };
4634                                                                    ErrorCode::HttpResponseBodySize(e69)
4635                                                                }
4636                                                                29 => {
4637                                                                    let e69 = {
4638                                                                        let l49 = i32::from(*ptr0.add(32).cast::<u8>());
4639                                                                        match l49 {
4640                                                                            0 => None,
4641                                                                            1 => {
4642                                                                                let e = {
4643                                                                                    let l50 = *ptr0.add(36).cast::<i32>();
4644                                                                                    l50 as u32
4645                                                                                };
4646                                                                                Some(e)
4647                                                                            }
4648                                                                            _ => _rt::invalid_enum_discriminant(),
4649                                                                        }
4650                                                                    };
4651                                                                    ErrorCode::HttpResponseTrailerSectionSize(e69)
4652                                                                }
4653                                                                30 => {
4654                                                                    let e69 = {
4655                                                                        let l51 = i32::from(*ptr0.add(32).cast::<u8>());
4656                                                                        let l55 = i32::from(
4657                                                                            *ptr0
4658                                                                                .add(32 + 3 * ::core::mem::size_of::<*const u8>())
4659                                                                                .cast::<u8>(),
4660                                                                        );
4661                                                                        FieldSizePayload {
4662                                                                            field_name: match l51 {
4663                                                                                0 => None,
4664                                                                                1 => {
4665                                                                                    let e = {
4666                                                                                        let l52 = *ptr0
4667                                                                                            .add(32 + 1 * ::core::mem::size_of::<*const u8>())
4668                                                                                            .cast::<*mut u8>();
4669                                                                                        let l53 = *ptr0
4670                                                                                            .add(32 + 2 * ::core::mem::size_of::<*const u8>())
4671                                                                                            .cast::<usize>();
4672                                                                                        let len54 = l53;
4673                                                                                        let bytes54 = _rt::Vec::from_raw_parts(
4674                                                                                            l52.cast(),
4675                                                                                            len54,
4676                                                                                            len54,
4677                                                                                        );
4678                                                                                        _rt::string_lift(bytes54)
4679                                                                                    };
4680                                                                                    Some(e)
4681                                                                                }
4682                                                                                _ => _rt::invalid_enum_discriminant(),
4683                                                                            },
4684                                                                            field_size: match l55 {
4685                                                                                0 => None,
4686                                                                                1 => {
4687                                                                                    let e = {
4688                                                                                        let l56 = *ptr0
4689                                                                                            .add(36 + 3 * ::core::mem::size_of::<*const u8>())
4690                                                                                            .cast::<i32>();
4691                                                                                        l56 as u32
4692                                                                                    };
4693                                                                                    Some(e)
4694                                                                                }
4695                                                                                _ => _rt::invalid_enum_discriminant(),
4696                                                                            },
4697                                                                        }
4698                                                                    };
4699                                                                    ErrorCode::HttpResponseTrailerSize(e69)
4700                                                                }
4701                                                                31 => {
4702                                                                    let e69 = {
4703                                                                        let l57 = i32::from(*ptr0.add(32).cast::<u8>());
4704                                                                        match l57 {
4705                                                                            0 => None,
4706                                                                            1 => {
4707                                                                                let e = {
4708                                                                                    let l58 = *ptr0
4709                                                                                        .add(32 + 1 * ::core::mem::size_of::<*const u8>())
4710                                                                                        .cast::<*mut u8>();
4711                                                                                    let l59 = *ptr0
4712                                                                                        .add(32 + 2 * ::core::mem::size_of::<*const u8>())
4713                                                                                        .cast::<usize>();
4714                                                                                    let len60 = l59;
4715                                                                                    let bytes60 = _rt::Vec::from_raw_parts(
4716                                                                                        l58.cast(),
4717                                                                                        len60,
4718                                                                                        len60,
4719                                                                                    );
4720                                                                                    _rt::string_lift(bytes60)
4721                                                                                };
4722                                                                                Some(e)
4723                                                                            }
4724                                                                            _ => _rt::invalid_enum_discriminant(),
4725                                                                        }
4726                                                                    };
4727                                                                    ErrorCode::HttpResponseTransferCoding(e69)
4728                                                                }
4729                                                                32 => {
4730                                                                    let e69 = {
4731                                                                        let l61 = i32::from(*ptr0.add(32).cast::<u8>());
4732                                                                        match l61 {
4733                                                                            0 => None,
4734                                                                            1 => {
4735                                                                                let e = {
4736                                                                                    let l62 = *ptr0
4737                                                                                        .add(32 + 1 * ::core::mem::size_of::<*const u8>())
4738                                                                                        .cast::<*mut u8>();
4739                                                                                    let l63 = *ptr0
4740                                                                                        .add(32 + 2 * ::core::mem::size_of::<*const u8>())
4741                                                                                        .cast::<usize>();
4742                                                                                    let len64 = l63;
4743                                                                                    let bytes64 = _rt::Vec::from_raw_parts(
4744                                                                                        l62.cast(),
4745                                                                                        len64,
4746                                                                                        len64,
4747                                                                                    );
4748                                                                                    _rt::string_lift(bytes64)
4749                                                                                };
4750                                                                                Some(e)
4751                                                                            }
4752                                                                            _ => _rt::invalid_enum_discriminant(),
4753                                                                        }
4754                                                                    };
4755                                                                    ErrorCode::HttpResponseContentCoding(e69)
4756                                                                }
4757                                                                33 => ErrorCode::HttpResponseTimeout,
4758                                                                34 => ErrorCode::HttpUpgradeFailed,
4759                                                                35 => ErrorCode::HttpProtocolError,
4760                                                                36 => ErrorCode::LoopDetected,
4761                                                                37 => ErrorCode::ConfigurationError,
4762                                                                n => {
4763                                                                    debug_assert_eq!(n, 38, "invalid enum discriminant");
4764                                                                    let e69 = {
4765                                                                        let l65 = i32::from(*ptr0.add(32).cast::<u8>());
4766                                                                        match l65 {
4767                                                                            0 => None,
4768                                                                            1 => {
4769                                                                                let e = {
4770                                                                                    let l66 = *ptr0
4771                                                                                        .add(32 + 1 * ::core::mem::size_of::<*const u8>())
4772                                                                                        .cast::<*mut u8>();
4773                                                                                    let l67 = *ptr0
4774                                                                                        .add(32 + 2 * ::core::mem::size_of::<*const u8>())
4775                                                                                        .cast::<usize>();
4776                                                                                    let len68 = l67;
4777                                                                                    let bytes68 = _rt::Vec::from_raw_parts(
4778                                                                                        l66.cast(),
4779                                                                                        len68,
4780                                                                                        len68,
4781                                                                                    );
4782                                                                                    _rt::string_lift(bytes68)
4783                                                                                };
4784                                                                                Some(e)
4785                                                                            }
4786                                                                            _ => _rt::invalid_enum_discriminant(),
4787                                                                        }
4788                                                                    };
4789                                                                    ErrorCode::InternalError(e69)
4790                                                                }
4791                                                            };
4792                                                            v69
4793                                                        };
4794                                                        Err(e)
4795                                                    }
4796                                                    _ => _rt::invalid_enum_discriminant(),
4797                                                }
4798                                            };
4799                                            Ok(e)
4800                                        }
4801                                        1 => {
4802                                            let e = ();
4803                                            Err(e)
4804                                        }
4805                                        _ => _rt::invalid_enum_discriminant(),
4806                                    }
4807                                };
4808                                Some(e)
4809                            }
4810                            _ => _rt::invalid_enum_discriminant(),
4811                        };
4812                        result70
4813                    }
4814                }
4815            }
4816            impl OutgoingResponse {
4817                #[allow(unused_unsafe, clippy::all)]
4818                /// Construct an `outgoing-response`, with a default `status-code` of `200`.
4819                /// If a different `status-code` is needed, it must be set via the
4820                /// `set-status-code` method.
4821                ///
4822                /// * `headers` is the HTTP Headers for the Response.
4823                #[allow(async_fn_in_trait)]
4824                pub fn new(headers: Headers) -> Self {
4825                    unsafe {
4826                        #[cfg(target_arch = "wasm32")]
4827                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
4828                        unsafe extern "C" {
4829                            #[link_name = "[constructor]outgoing-response"]
4830                            fn wit_import0(_: i32) -> i32;
4831                        }
4832                        #[cfg(not(target_arch = "wasm32"))]
4833                        unsafe extern "C" fn wit_import0(_: i32) -> i32 {
4834                            unreachable!()
4835                        }
4836                        let ret = wit_import0((&headers).take_handle() as i32);
4837                        OutgoingResponse::from_handle(ret as u32)
4838                    }
4839                }
4840            }
4841            impl OutgoingResponse {
4842                #[allow(unused_unsafe, clippy::all)]
4843                /// Get the HTTP Status Code for the Response.
4844                #[allow(async_fn_in_trait)]
4845                pub fn status_code(&self) -> StatusCode {
4846                    unsafe {
4847                        #[cfg(target_arch = "wasm32")]
4848                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
4849                        unsafe extern "C" {
4850                            #[link_name = "[method]outgoing-response.status-code"]
4851                            fn wit_import0(_: i32) -> i32;
4852                        }
4853                        #[cfg(not(target_arch = "wasm32"))]
4854                        unsafe extern "C" fn wit_import0(_: i32) -> i32 {
4855                            unreachable!()
4856                        }
4857                        let ret = wit_import0((self).handle() as i32);
4858                        ret as u16
4859                    }
4860                }
4861            }
4862            impl OutgoingResponse {
4863                #[allow(unused_unsafe, clippy::all)]
4864                /// Set the HTTP Status Code for the Response. Fails if the status-code
4865                /// given is not a valid http status code.
4866                #[allow(async_fn_in_trait)]
4867                pub fn set_status_code(
4868                    &self,
4869                    status_code: StatusCode,
4870                ) -> Result<(), ()> {
4871                    unsafe {
4872                        #[cfg(target_arch = "wasm32")]
4873                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
4874                        unsafe extern "C" {
4875                            #[link_name = "[method]outgoing-response.set-status-code"]
4876                            fn wit_import0(_: i32, _: i32) -> i32;
4877                        }
4878                        #[cfg(not(target_arch = "wasm32"))]
4879                        unsafe extern "C" fn wit_import0(_: i32, _: i32) -> i32 {
4880                            unreachable!()
4881                        }
4882                        let ret = wit_import0(
4883                            (self).handle() as i32,
4884                            _rt::as_i32(status_code),
4885                        );
4886                        match ret {
4887                            0 => {
4888                                let e = ();
4889                                Ok(e)
4890                            }
4891                            1 => {
4892                                let e = ();
4893                                Err(e)
4894                            }
4895                            _ => _rt::invalid_enum_discriminant(),
4896                        }
4897                    }
4898                }
4899            }
4900            impl OutgoingResponse {
4901                #[allow(unused_unsafe, clippy::all)]
4902                /// Get the headers associated with the Request.
4903                ///
4904                /// The returned `headers` resource is immutable: `set`, `append`, and
4905                /// `delete` operations will fail with `header-error.immutable`.
4906                ///
4907                /// This headers resource is a child: it must be dropped before the parent
4908                /// `outgoing-request` is dropped, or its ownership is transferred to
4909                /// another component by e.g. `outgoing-handler.handle`.
4910                #[allow(async_fn_in_trait)]
4911                pub fn headers(&self) -> Headers {
4912                    unsafe {
4913                        #[cfg(target_arch = "wasm32")]
4914                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
4915                        unsafe extern "C" {
4916                            #[link_name = "[method]outgoing-response.headers"]
4917                            fn wit_import0(_: i32) -> i32;
4918                        }
4919                        #[cfg(not(target_arch = "wasm32"))]
4920                        unsafe extern "C" fn wit_import0(_: i32) -> i32 {
4921                            unreachable!()
4922                        }
4923                        let ret = wit_import0((self).handle() as i32);
4924                        Fields::from_handle(ret as u32)
4925                    }
4926                }
4927            }
4928            impl OutgoingResponse {
4929                #[allow(unused_unsafe, clippy::all)]
4930                /// Returns the resource corresponding to the outgoing Body for this Response.
4931                ///
4932                /// Returns success on the first call: the `outgoing-body` resource for
4933                /// this `outgoing-response` can be retrieved at most once. Subsequent
4934                /// calls will return error.
4935                #[allow(async_fn_in_trait)]
4936                pub fn body(&self) -> Result<OutgoingBody, ()> {
4937                    unsafe {
4938                        #[repr(align(4))]
4939                        struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
4940                        let mut ret_area = RetArea(
4941                            [::core::mem::MaybeUninit::uninit(); 8],
4942                        );
4943                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
4944                        #[cfg(target_arch = "wasm32")]
4945                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
4946                        unsafe extern "C" {
4947                            #[link_name = "[method]outgoing-response.body"]
4948                            fn wit_import1(_: i32, _: *mut u8);
4949                        }
4950                        #[cfg(not(target_arch = "wasm32"))]
4951                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
4952                            unreachable!()
4953                        }
4954                        wit_import1((self).handle() as i32, ptr0);
4955                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
4956                        let result4 = match l2 {
4957                            0 => {
4958                                let e = {
4959                                    let l3 = *ptr0.add(4).cast::<i32>();
4960                                    OutgoingBody::from_handle(l3 as u32)
4961                                };
4962                                Ok(e)
4963                            }
4964                            1 => {
4965                                let e = ();
4966                                Err(e)
4967                            }
4968                            _ => _rt::invalid_enum_discriminant(),
4969                        };
4970                        result4
4971                    }
4972                }
4973            }
4974            impl OutgoingBody {
4975                #[allow(unused_unsafe, clippy::all)]
4976                /// Returns a stream for writing the body contents.
4977                ///
4978                /// The returned `output-stream` is a child resource: it must be dropped
4979                /// before the parent `outgoing-body` resource is dropped (or finished),
4980                /// otherwise the `outgoing-body` drop or `finish` will trap.
4981                ///
4982                /// Returns success on the first call: the `output-stream` resource for
4983                /// this `outgoing-body` may be retrieved at most once. Subsequent calls
4984                /// will return error.
4985                #[allow(async_fn_in_trait)]
4986                pub fn write(&self) -> Result<OutputStream, ()> {
4987                    unsafe {
4988                        #[repr(align(4))]
4989                        struct RetArea([::core::mem::MaybeUninit<u8>; 8]);
4990                        let mut ret_area = RetArea(
4991                            [::core::mem::MaybeUninit::uninit(); 8],
4992                        );
4993                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
4994                        #[cfg(target_arch = "wasm32")]
4995                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
4996                        unsafe extern "C" {
4997                            #[link_name = "[method]outgoing-body.write"]
4998                            fn wit_import1(_: i32, _: *mut u8);
4999                        }
5000                        #[cfg(not(target_arch = "wasm32"))]
5001                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
5002                            unreachable!()
5003                        }
5004                        wit_import1((self).handle() as i32, ptr0);
5005                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
5006                        let result4 = match l2 {
5007                            0 => {
5008                                let e = {
5009                                    let l3 = *ptr0.add(4).cast::<i32>();
5010                                    super::super::super::__with_name5::OutputStream::from_handle(
5011                                        l3 as u32,
5012                                    )
5013                                };
5014                                Ok(e)
5015                            }
5016                            1 => {
5017                                let e = ();
5018                                Err(e)
5019                            }
5020                            _ => _rt::invalid_enum_discriminant(),
5021                        };
5022                        result4
5023                    }
5024                }
5025            }
5026            impl OutgoingBody {
5027                #[allow(unused_unsafe, clippy::all)]
5028                /// Finalize an outgoing body, optionally providing trailers. This must be
5029                /// called to signal that the response is complete. If the `outgoing-body`
5030                /// is dropped without calling `outgoing-body.finalize`, the implementation
5031                /// should treat the body as corrupted.
5032                ///
5033                /// Fails if the body's `outgoing-request` or `outgoing-response` was
5034                /// constructed with a Content-Length header, and the contents written
5035                /// to the body (via `write`) does not match the value given in the
5036                /// Content-Length.
5037                #[allow(async_fn_in_trait)]
5038                pub fn finish(
5039                    this: OutgoingBody,
5040                    trailers: Option<Trailers>,
5041                ) -> Result<(), ErrorCode> {
5042                    unsafe {
5043                        #[repr(align(8))]
5044                        struct RetArea(
5045                            [::core::mem::MaybeUninit<
5046                                u8,
5047                            >; 24 + 4 * ::core::mem::size_of::<*const u8>()],
5048                        );
5049                        let mut ret_area = RetArea(
5050                            [::core::mem::MaybeUninit::uninit(); 24
5051                                + 4 * ::core::mem::size_of::<*const u8>()],
5052                        );
5053                        let (result0_0, result0_1) = match &trailers {
5054                            Some(e) => (1i32, (e).take_handle() as i32),
5055                            None => (0i32, 0i32),
5056                        };
5057                        let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
5058                        #[cfg(target_arch = "wasm32")]
5059                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
5060                        unsafe extern "C" {
5061                            #[link_name = "[static]outgoing-body.finish"]
5062                            fn wit_import2(_: i32, _: i32, _: i32, _: *mut u8);
5063                        }
5064                        #[cfg(not(target_arch = "wasm32"))]
5065                        unsafe extern "C" fn wit_import2(
5066                            _: i32,
5067                            _: i32,
5068                            _: i32,
5069                            _: *mut u8,
5070                        ) {
5071                            unreachable!()
5072                        }
5073                        wit_import2(
5074                            (&this).take_handle() as i32,
5075                            result0_0,
5076                            result0_1,
5077                            ptr1,
5078                        );
5079                        let l3 = i32::from(*ptr1.add(0).cast::<u8>());
5080                        let result67 = match l3 {
5081                            0 => {
5082                                let e = ();
5083                                Ok(e)
5084                            }
5085                            1 => {
5086                                let e = {
5087                                    let l4 = i32::from(*ptr1.add(8).cast::<u8>());
5088                                    let v66 = match l4 {
5089                                        0 => ErrorCode::DnsTimeout,
5090                                        1 => {
5091                                            let e66 = {
5092                                                let l5 = i32::from(*ptr1.add(16).cast::<u8>());
5093                                                let l9 = i32::from(
5094                                                    *ptr1
5095                                                        .add(16 + 3 * ::core::mem::size_of::<*const u8>())
5096                                                        .cast::<u8>(),
5097                                                );
5098                                                DnsErrorPayload {
5099                                                    rcode: match l5 {
5100                                                        0 => None,
5101                                                        1 => {
5102                                                            let e = {
5103                                                                let l6 = *ptr1
5104                                                                    .add(16 + 1 * ::core::mem::size_of::<*const u8>())
5105                                                                    .cast::<*mut u8>();
5106                                                                let l7 = *ptr1
5107                                                                    .add(16 + 2 * ::core::mem::size_of::<*const u8>())
5108                                                                    .cast::<usize>();
5109                                                                let len8 = l7;
5110                                                                let bytes8 = _rt::Vec::from_raw_parts(
5111                                                                    l6.cast(),
5112                                                                    len8,
5113                                                                    len8,
5114                                                                );
5115                                                                _rt::string_lift(bytes8)
5116                                                            };
5117                                                            Some(e)
5118                                                        }
5119                                                        _ => _rt::invalid_enum_discriminant(),
5120                                                    },
5121                                                    info_code: match l9 {
5122                                                        0 => None,
5123                                                        1 => {
5124                                                            let e = {
5125                                                                let l10 = i32::from(
5126                                                                    *ptr1
5127                                                                        .add(18 + 3 * ::core::mem::size_of::<*const u8>())
5128                                                                        .cast::<u16>(),
5129                                                                );
5130                                                                l10 as u16
5131                                                            };
5132                                                            Some(e)
5133                                                        }
5134                                                        _ => _rt::invalid_enum_discriminant(),
5135                                                    },
5136                                                }
5137                                            };
5138                                            ErrorCode::DnsError(e66)
5139                                        }
5140                                        2 => ErrorCode::DestinationNotFound,
5141                                        3 => ErrorCode::DestinationUnavailable,
5142                                        4 => ErrorCode::DestinationIpProhibited,
5143                                        5 => ErrorCode::DestinationIpUnroutable,
5144                                        6 => ErrorCode::ConnectionRefused,
5145                                        7 => ErrorCode::ConnectionTerminated,
5146                                        8 => ErrorCode::ConnectionTimeout,
5147                                        9 => ErrorCode::ConnectionReadTimeout,
5148                                        10 => ErrorCode::ConnectionWriteTimeout,
5149                                        11 => ErrorCode::ConnectionLimitReached,
5150                                        12 => ErrorCode::TlsProtocolError,
5151                                        13 => ErrorCode::TlsCertificateError,
5152                                        14 => {
5153                                            let e66 = {
5154                                                let l11 = i32::from(*ptr1.add(16).cast::<u8>());
5155                                                let l13 = i32::from(
5156                                                    *ptr1
5157                                                        .add(16 + 1 * ::core::mem::size_of::<*const u8>())
5158                                                        .cast::<u8>(),
5159                                                );
5160                                                TlsAlertReceivedPayload {
5161                                                    alert_id: match l11 {
5162                                                        0 => None,
5163                                                        1 => {
5164                                                            let e = {
5165                                                                let l12 = i32::from(*ptr1.add(17).cast::<u8>());
5166                                                                l12 as u8
5167                                                            };
5168                                                            Some(e)
5169                                                        }
5170                                                        _ => _rt::invalid_enum_discriminant(),
5171                                                    },
5172                                                    alert_message: match l13 {
5173                                                        0 => None,
5174                                                        1 => {
5175                                                            let e = {
5176                                                                let l14 = *ptr1
5177                                                                    .add(16 + 2 * ::core::mem::size_of::<*const u8>())
5178                                                                    .cast::<*mut u8>();
5179                                                                let l15 = *ptr1
5180                                                                    .add(16 + 3 * ::core::mem::size_of::<*const u8>())
5181                                                                    .cast::<usize>();
5182                                                                let len16 = l15;
5183                                                                let bytes16 = _rt::Vec::from_raw_parts(
5184                                                                    l14.cast(),
5185                                                                    len16,
5186                                                                    len16,
5187                                                                );
5188                                                                _rt::string_lift(bytes16)
5189                                                            };
5190                                                            Some(e)
5191                                                        }
5192                                                        _ => _rt::invalid_enum_discriminant(),
5193                                                    },
5194                                                }
5195                                            };
5196                                            ErrorCode::TlsAlertReceived(e66)
5197                                        }
5198                                        15 => ErrorCode::HttpRequestDenied,
5199                                        16 => ErrorCode::HttpRequestLengthRequired,
5200                                        17 => {
5201                                            let e66 = {
5202                                                let l17 = i32::from(*ptr1.add(16).cast::<u8>());
5203                                                match l17 {
5204                                                    0 => None,
5205                                                    1 => {
5206                                                        let e = {
5207                                                            let l18 = *ptr1.add(24).cast::<i64>();
5208                                                            l18 as u64
5209                                                        };
5210                                                        Some(e)
5211                                                    }
5212                                                    _ => _rt::invalid_enum_discriminant(),
5213                                                }
5214                                            };
5215                                            ErrorCode::HttpRequestBodySize(e66)
5216                                        }
5217                                        18 => ErrorCode::HttpRequestMethodInvalid,
5218                                        19 => ErrorCode::HttpRequestUriInvalid,
5219                                        20 => ErrorCode::HttpRequestUriTooLong,
5220                                        21 => {
5221                                            let e66 = {
5222                                                let l19 = i32::from(*ptr1.add(16).cast::<u8>());
5223                                                match l19 {
5224                                                    0 => None,
5225                                                    1 => {
5226                                                        let e = {
5227                                                            let l20 = *ptr1.add(20).cast::<i32>();
5228                                                            l20 as u32
5229                                                        };
5230                                                        Some(e)
5231                                                    }
5232                                                    _ => _rt::invalid_enum_discriminant(),
5233                                                }
5234                                            };
5235                                            ErrorCode::HttpRequestHeaderSectionSize(e66)
5236                                        }
5237                                        22 => {
5238                                            let e66 = {
5239                                                let l21 = i32::from(*ptr1.add(16).cast::<u8>());
5240                                                match l21 {
5241                                                    0 => None,
5242                                                    1 => {
5243                                                        let e = {
5244                                                            let l22 = i32::from(
5245                                                                *ptr1
5246                                                                    .add(16 + 1 * ::core::mem::size_of::<*const u8>())
5247                                                                    .cast::<u8>(),
5248                                                            );
5249                                                            let l26 = i32::from(
5250                                                                *ptr1
5251                                                                    .add(16 + 4 * ::core::mem::size_of::<*const u8>())
5252                                                                    .cast::<u8>(),
5253                                                            );
5254                                                            FieldSizePayload {
5255                                                                field_name: match l22 {
5256                                                                    0 => None,
5257                                                                    1 => {
5258                                                                        let e = {
5259                                                                            let l23 = *ptr1
5260                                                                                .add(16 + 2 * ::core::mem::size_of::<*const u8>())
5261                                                                                .cast::<*mut u8>();
5262                                                                            let l24 = *ptr1
5263                                                                                .add(16 + 3 * ::core::mem::size_of::<*const u8>())
5264                                                                                .cast::<usize>();
5265                                                                            let len25 = l24;
5266                                                                            let bytes25 = _rt::Vec::from_raw_parts(
5267                                                                                l23.cast(),
5268                                                                                len25,
5269                                                                                len25,
5270                                                                            );
5271                                                                            _rt::string_lift(bytes25)
5272                                                                        };
5273                                                                        Some(e)
5274                                                                    }
5275                                                                    _ => _rt::invalid_enum_discriminant(),
5276                                                                },
5277                                                                field_size: match l26 {
5278                                                                    0 => None,
5279                                                                    1 => {
5280                                                                        let e = {
5281                                                                            let l27 = *ptr1
5282                                                                                .add(20 + 4 * ::core::mem::size_of::<*const u8>())
5283                                                                                .cast::<i32>();
5284                                                                            l27 as u32
5285                                                                        };
5286                                                                        Some(e)
5287                                                                    }
5288                                                                    _ => _rt::invalid_enum_discriminant(),
5289                                                                },
5290                                                            }
5291                                                        };
5292                                                        Some(e)
5293                                                    }
5294                                                    _ => _rt::invalid_enum_discriminant(),
5295                                                }
5296                                            };
5297                                            ErrorCode::HttpRequestHeaderSize(e66)
5298                                        }
5299                                        23 => {
5300                                            let e66 = {
5301                                                let l28 = i32::from(*ptr1.add(16).cast::<u8>());
5302                                                match l28 {
5303                                                    0 => None,
5304                                                    1 => {
5305                                                        let e = {
5306                                                            let l29 = *ptr1.add(20).cast::<i32>();
5307                                                            l29 as u32
5308                                                        };
5309                                                        Some(e)
5310                                                    }
5311                                                    _ => _rt::invalid_enum_discriminant(),
5312                                                }
5313                                            };
5314                                            ErrorCode::HttpRequestTrailerSectionSize(e66)
5315                                        }
5316                                        24 => {
5317                                            let e66 = {
5318                                                let l30 = i32::from(*ptr1.add(16).cast::<u8>());
5319                                                let l34 = i32::from(
5320                                                    *ptr1
5321                                                        .add(16 + 3 * ::core::mem::size_of::<*const u8>())
5322                                                        .cast::<u8>(),
5323                                                );
5324                                                FieldSizePayload {
5325                                                    field_name: match l30 {
5326                                                        0 => None,
5327                                                        1 => {
5328                                                            let e = {
5329                                                                let l31 = *ptr1
5330                                                                    .add(16 + 1 * ::core::mem::size_of::<*const u8>())
5331                                                                    .cast::<*mut u8>();
5332                                                                let l32 = *ptr1
5333                                                                    .add(16 + 2 * ::core::mem::size_of::<*const u8>())
5334                                                                    .cast::<usize>();
5335                                                                let len33 = l32;
5336                                                                let bytes33 = _rt::Vec::from_raw_parts(
5337                                                                    l31.cast(),
5338                                                                    len33,
5339                                                                    len33,
5340                                                                );
5341                                                                _rt::string_lift(bytes33)
5342                                                            };
5343                                                            Some(e)
5344                                                        }
5345                                                        _ => _rt::invalid_enum_discriminant(),
5346                                                    },
5347                                                    field_size: match l34 {
5348                                                        0 => None,
5349                                                        1 => {
5350                                                            let e = {
5351                                                                let l35 = *ptr1
5352                                                                    .add(20 + 3 * ::core::mem::size_of::<*const u8>())
5353                                                                    .cast::<i32>();
5354                                                                l35 as u32
5355                                                            };
5356                                                            Some(e)
5357                                                        }
5358                                                        _ => _rt::invalid_enum_discriminant(),
5359                                                    },
5360                                                }
5361                                            };
5362                                            ErrorCode::HttpRequestTrailerSize(e66)
5363                                        }
5364                                        25 => ErrorCode::HttpResponseIncomplete,
5365                                        26 => {
5366                                            let e66 = {
5367                                                let l36 = i32::from(*ptr1.add(16).cast::<u8>());
5368                                                match l36 {
5369                                                    0 => None,
5370                                                    1 => {
5371                                                        let e = {
5372                                                            let l37 = *ptr1.add(20).cast::<i32>();
5373                                                            l37 as u32
5374                                                        };
5375                                                        Some(e)
5376                                                    }
5377                                                    _ => _rt::invalid_enum_discriminant(),
5378                                                }
5379                                            };
5380                                            ErrorCode::HttpResponseHeaderSectionSize(e66)
5381                                        }
5382                                        27 => {
5383                                            let e66 = {
5384                                                let l38 = i32::from(*ptr1.add(16).cast::<u8>());
5385                                                let l42 = i32::from(
5386                                                    *ptr1
5387                                                        .add(16 + 3 * ::core::mem::size_of::<*const u8>())
5388                                                        .cast::<u8>(),
5389                                                );
5390                                                FieldSizePayload {
5391                                                    field_name: match l38 {
5392                                                        0 => None,
5393                                                        1 => {
5394                                                            let e = {
5395                                                                let l39 = *ptr1
5396                                                                    .add(16 + 1 * ::core::mem::size_of::<*const u8>())
5397                                                                    .cast::<*mut u8>();
5398                                                                let l40 = *ptr1
5399                                                                    .add(16 + 2 * ::core::mem::size_of::<*const u8>())
5400                                                                    .cast::<usize>();
5401                                                                let len41 = l40;
5402                                                                let bytes41 = _rt::Vec::from_raw_parts(
5403                                                                    l39.cast(),
5404                                                                    len41,
5405                                                                    len41,
5406                                                                );
5407                                                                _rt::string_lift(bytes41)
5408                                                            };
5409                                                            Some(e)
5410                                                        }
5411                                                        _ => _rt::invalid_enum_discriminant(),
5412                                                    },
5413                                                    field_size: match l42 {
5414                                                        0 => None,
5415                                                        1 => {
5416                                                            let e = {
5417                                                                let l43 = *ptr1
5418                                                                    .add(20 + 3 * ::core::mem::size_of::<*const u8>())
5419                                                                    .cast::<i32>();
5420                                                                l43 as u32
5421                                                            };
5422                                                            Some(e)
5423                                                        }
5424                                                        _ => _rt::invalid_enum_discriminant(),
5425                                                    },
5426                                                }
5427                                            };
5428                                            ErrorCode::HttpResponseHeaderSize(e66)
5429                                        }
5430                                        28 => {
5431                                            let e66 = {
5432                                                let l44 = i32::from(*ptr1.add(16).cast::<u8>());
5433                                                match l44 {
5434                                                    0 => None,
5435                                                    1 => {
5436                                                        let e = {
5437                                                            let l45 = *ptr1.add(24).cast::<i64>();
5438                                                            l45 as u64
5439                                                        };
5440                                                        Some(e)
5441                                                    }
5442                                                    _ => _rt::invalid_enum_discriminant(),
5443                                                }
5444                                            };
5445                                            ErrorCode::HttpResponseBodySize(e66)
5446                                        }
5447                                        29 => {
5448                                            let e66 = {
5449                                                let l46 = i32::from(*ptr1.add(16).cast::<u8>());
5450                                                match l46 {
5451                                                    0 => None,
5452                                                    1 => {
5453                                                        let e = {
5454                                                            let l47 = *ptr1.add(20).cast::<i32>();
5455                                                            l47 as u32
5456                                                        };
5457                                                        Some(e)
5458                                                    }
5459                                                    _ => _rt::invalid_enum_discriminant(),
5460                                                }
5461                                            };
5462                                            ErrorCode::HttpResponseTrailerSectionSize(e66)
5463                                        }
5464                                        30 => {
5465                                            let e66 = {
5466                                                let l48 = i32::from(*ptr1.add(16).cast::<u8>());
5467                                                let l52 = i32::from(
5468                                                    *ptr1
5469                                                        .add(16 + 3 * ::core::mem::size_of::<*const u8>())
5470                                                        .cast::<u8>(),
5471                                                );
5472                                                FieldSizePayload {
5473                                                    field_name: match l48 {
5474                                                        0 => None,
5475                                                        1 => {
5476                                                            let e = {
5477                                                                let l49 = *ptr1
5478                                                                    .add(16 + 1 * ::core::mem::size_of::<*const u8>())
5479                                                                    .cast::<*mut u8>();
5480                                                                let l50 = *ptr1
5481                                                                    .add(16 + 2 * ::core::mem::size_of::<*const u8>())
5482                                                                    .cast::<usize>();
5483                                                                let len51 = l50;
5484                                                                let bytes51 = _rt::Vec::from_raw_parts(
5485                                                                    l49.cast(),
5486                                                                    len51,
5487                                                                    len51,
5488                                                                );
5489                                                                _rt::string_lift(bytes51)
5490                                                            };
5491                                                            Some(e)
5492                                                        }
5493                                                        _ => _rt::invalid_enum_discriminant(),
5494                                                    },
5495                                                    field_size: match l52 {
5496                                                        0 => None,
5497                                                        1 => {
5498                                                            let e = {
5499                                                                let l53 = *ptr1
5500                                                                    .add(20 + 3 * ::core::mem::size_of::<*const u8>())
5501                                                                    .cast::<i32>();
5502                                                                l53 as u32
5503                                                            };
5504                                                            Some(e)
5505                                                        }
5506                                                        _ => _rt::invalid_enum_discriminant(),
5507                                                    },
5508                                                }
5509                                            };
5510                                            ErrorCode::HttpResponseTrailerSize(e66)
5511                                        }
5512                                        31 => {
5513                                            let e66 = {
5514                                                let l54 = i32::from(*ptr1.add(16).cast::<u8>());
5515                                                match l54 {
5516                                                    0 => None,
5517                                                    1 => {
5518                                                        let e = {
5519                                                            let l55 = *ptr1
5520                                                                .add(16 + 1 * ::core::mem::size_of::<*const u8>())
5521                                                                .cast::<*mut u8>();
5522                                                            let l56 = *ptr1
5523                                                                .add(16 + 2 * ::core::mem::size_of::<*const u8>())
5524                                                                .cast::<usize>();
5525                                                            let len57 = l56;
5526                                                            let bytes57 = _rt::Vec::from_raw_parts(
5527                                                                l55.cast(),
5528                                                                len57,
5529                                                                len57,
5530                                                            );
5531                                                            _rt::string_lift(bytes57)
5532                                                        };
5533                                                        Some(e)
5534                                                    }
5535                                                    _ => _rt::invalid_enum_discriminant(),
5536                                                }
5537                                            };
5538                                            ErrorCode::HttpResponseTransferCoding(e66)
5539                                        }
5540                                        32 => {
5541                                            let e66 = {
5542                                                let l58 = i32::from(*ptr1.add(16).cast::<u8>());
5543                                                match l58 {
5544                                                    0 => None,
5545                                                    1 => {
5546                                                        let e = {
5547                                                            let l59 = *ptr1
5548                                                                .add(16 + 1 * ::core::mem::size_of::<*const u8>())
5549                                                                .cast::<*mut u8>();
5550                                                            let l60 = *ptr1
5551                                                                .add(16 + 2 * ::core::mem::size_of::<*const u8>())
5552                                                                .cast::<usize>();
5553                                                            let len61 = l60;
5554                                                            let bytes61 = _rt::Vec::from_raw_parts(
5555                                                                l59.cast(),
5556                                                                len61,
5557                                                                len61,
5558                                                            );
5559                                                            _rt::string_lift(bytes61)
5560                                                        };
5561                                                        Some(e)
5562                                                    }
5563                                                    _ => _rt::invalid_enum_discriminant(),
5564                                                }
5565                                            };
5566                                            ErrorCode::HttpResponseContentCoding(e66)
5567                                        }
5568                                        33 => ErrorCode::HttpResponseTimeout,
5569                                        34 => ErrorCode::HttpUpgradeFailed,
5570                                        35 => ErrorCode::HttpProtocolError,
5571                                        36 => ErrorCode::LoopDetected,
5572                                        37 => ErrorCode::ConfigurationError,
5573                                        n => {
5574                                            debug_assert_eq!(n, 38, "invalid enum discriminant");
5575                                            let e66 = {
5576                                                let l62 = i32::from(*ptr1.add(16).cast::<u8>());
5577                                                match l62 {
5578                                                    0 => None,
5579                                                    1 => {
5580                                                        let e = {
5581                                                            let l63 = *ptr1
5582                                                                .add(16 + 1 * ::core::mem::size_of::<*const u8>())
5583                                                                .cast::<*mut u8>();
5584                                                            let l64 = *ptr1
5585                                                                .add(16 + 2 * ::core::mem::size_of::<*const u8>())
5586                                                                .cast::<usize>();
5587                                                            let len65 = l64;
5588                                                            let bytes65 = _rt::Vec::from_raw_parts(
5589                                                                l63.cast(),
5590                                                                len65,
5591                                                                len65,
5592                                                            );
5593                                                            _rt::string_lift(bytes65)
5594                                                        };
5595                                                        Some(e)
5596                                                    }
5597                                                    _ => _rt::invalid_enum_discriminant(),
5598                                                }
5599                                            };
5600                                            ErrorCode::InternalError(e66)
5601                                        }
5602                                    };
5603                                    v66
5604                                };
5605                                Err(e)
5606                            }
5607                            _ => _rt::invalid_enum_discriminant(),
5608                        };
5609                        result67
5610                    }
5611                }
5612            }
5613            impl FutureIncomingResponse {
5614                #[allow(unused_unsafe, clippy::all)]
5615                /// Returns a pollable which becomes ready when either the Response has
5616                /// been received, or an error has occurred. When this pollable is ready,
5617                /// the `get` method will return `some`.
5618                #[allow(async_fn_in_trait)]
5619                pub fn subscribe(&self) -> Pollable {
5620                    unsafe {
5621                        #[cfg(target_arch = "wasm32")]
5622                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
5623                        unsafe extern "C" {
5624                            #[link_name = "[method]future-incoming-response.subscribe"]
5625                            fn wit_import0(_: i32) -> i32;
5626                        }
5627                        #[cfg(not(target_arch = "wasm32"))]
5628                        unsafe extern "C" fn wit_import0(_: i32) -> i32 {
5629                            unreachable!()
5630                        }
5631                        let ret = wit_import0((self).handle() as i32);
5632                        super::super::super::__with_name0::Pollable::from_handle(
5633                            ret as u32,
5634                        )
5635                    }
5636                }
5637            }
5638            impl FutureIncomingResponse {
5639                #[allow(unused_unsafe, clippy::all)]
5640                /// Returns the incoming HTTP Response, or an error, once one is ready.
5641                ///
5642                /// The outer `option` represents future readiness. Users can wait on this
5643                /// `option` to become `some` using the `subscribe` method.
5644                ///
5645                /// The outer `result` is used to retrieve the response or error at most
5646                /// once. It will be success on the first call in which the outer option
5647                /// is `some`, and error on subsequent calls.
5648                ///
5649                /// The inner `result` represents that either the incoming HTTP Response
5650                /// status and headers have received successfully, or that an error
5651                /// occurred. Errors may also occur while consuming the response body,
5652                /// but those will be reported by the `incoming-body` and its
5653                /// `output-stream` child.
5654                #[allow(async_fn_in_trait)]
5655                pub fn get(
5656                    &self,
5657                ) -> Option<Result<Result<IncomingResponse, ErrorCode>, ()>> {
5658                    unsafe {
5659                        #[repr(align(8))]
5660                        struct RetArea(
5661                            [::core::mem::MaybeUninit<
5662                                u8,
5663                            >; 40 + 4 * ::core::mem::size_of::<*const u8>()],
5664                        );
5665                        let mut ret_area = RetArea(
5666                            [::core::mem::MaybeUninit::uninit(); 40
5667                                + 4 * ::core::mem::size_of::<*const u8>()],
5668                        );
5669                        let ptr0 = ret_area.0.as_mut_ptr().cast::<u8>();
5670                        #[cfg(target_arch = "wasm32")]
5671                        #[link(wasm_import_module = "wasi:http/types@0.2.4")]
5672                        unsafe extern "C" {
5673                            #[link_name = "[method]future-incoming-response.get"]
5674                            fn wit_import1(_: i32, _: *mut u8);
5675                        }
5676                        #[cfg(not(target_arch = "wasm32"))]
5677                        unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) {
5678                            unreachable!()
5679                        }
5680                        wit_import1((self).handle() as i32, ptr0);
5681                        let l2 = i32::from(*ptr0.add(0).cast::<u8>());
5682                        let result69 = match l2 {
5683                            0 => None,
5684                            1 => {
5685                                let e = {
5686                                    let l3 = i32::from(*ptr0.add(8).cast::<u8>());
5687                                    match l3 {
5688                                        0 => {
5689                                            let e = {
5690                                                let l4 = i32::from(*ptr0.add(16).cast::<u8>());
5691                                                match l4 {
5692                                                    0 => {
5693                                                        let e = {
5694                                                            let l5 = *ptr0.add(24).cast::<i32>();
5695                                                            IncomingResponse::from_handle(l5 as u32)
5696                                                        };
5697                                                        Ok(e)
5698                                                    }
5699                                                    1 => {
5700                                                        let e = {
5701                                                            let l6 = i32::from(*ptr0.add(24).cast::<u8>());
5702                                                            let v68 = match l6 {
5703                                                                0 => ErrorCode::DnsTimeout,
5704                                                                1 => {
5705                                                                    let e68 = {
5706                                                                        let l7 = i32::from(*ptr0.add(32).cast::<u8>());
5707                                                                        let l11 = i32::from(
5708                                                                            *ptr0
5709                                                                                .add(32 + 3 * ::core::mem::size_of::<*const u8>())
5710                                                                                .cast::<u8>(),
5711                                                                        );
5712                                                                        DnsErrorPayload {
5713                                                                            rcode: match l7 {
5714                                                                                0 => None,
5715                                                                                1 => {
5716                                                                                    let e = {
5717                                                                                        let l8 = *ptr0
5718                                                                                            .add(32 + 1 * ::core::mem::size_of::<*const u8>())
5719                                                                                            .cast::<*mut u8>();
5720                                                                                        let l9 = *ptr0
5721                                                                                            .add(32 + 2 * ::core::mem::size_of::<*const u8>())
5722                                                                                            .cast::<usize>();
5723                                                                                        let len10 = l9;
5724                                                                                        let bytes10 = _rt::Vec::from_raw_parts(
5725                                                                                            l8.cast(),
5726                                                                                            len10,
5727                                                                                            len10,
5728                                                                                        );
5729                                                                                        _rt::string_lift(bytes10)
5730                                                                                    };
5731                                                                                    Some(e)
5732                                                                                }
5733                                                                                _ => _rt::invalid_enum_discriminant(),
5734                                                                            },
5735                                                                            info_code: match l11 {
5736                                                                                0 => None,
5737                                                                                1 => {
5738                                                                                    let e = {
5739                                                                                        let l12 = i32::from(
5740                                                                                            *ptr0
5741                                                                                                .add(34 + 3 * ::core::mem::size_of::<*const u8>())
5742                                                                                                .cast::<u16>(),
5743                                                                                        );
5744                                                                                        l12 as u16
5745                                                                                    };
5746                                                                                    Some(e)
5747                                                                                }
5748                                                                                _ => _rt::invalid_enum_discriminant(),
5749                                                                            },
5750                                                                        }
5751                                                                    };
5752                                                                    ErrorCode::DnsError(e68)
5753                                                                }
5754                                                                2 => ErrorCode::DestinationNotFound,
5755                                                                3 => ErrorCode::DestinationUnavailable,
5756                                                                4 => ErrorCode::DestinationIpProhibited,
5757                                                                5 => ErrorCode::DestinationIpUnroutable,
5758                                                                6 => ErrorCode::ConnectionRefused,
5759                                                                7 => ErrorCode::ConnectionTerminated,
5760                                                                8 => ErrorCode::ConnectionTimeout,
5761                                                                9 => ErrorCode::ConnectionReadTimeout,
5762                                                                10 => ErrorCode::ConnectionWriteTimeout,
5763                                                                11 => ErrorCode::ConnectionLimitReached,
5764                                                                12 => ErrorCode::TlsProtocolError,
5765                                                                13 => ErrorCode::TlsCertificateError,
5766                                                                14 => {
5767                                                                    let e68 = {
5768                                                                        let l13 = i32::from(*ptr0.add(32).cast::<u8>());
5769                                                                        let l15 = i32::from(
5770                                                                            *ptr0
5771                                                                                .add(32 + 1 * ::core::mem::size_of::<*const u8>())
5772                                                                                .cast::<u8>(),
5773                                                                        );
5774                                                                        TlsAlertReceivedPayload {
5775                                                                            alert_id: match l13 {
5776                                                                                0 => None,
5777                                                                                1 => {
5778                                                                                    let e = {
5779                                                                                        let l14 = i32::from(*ptr0.add(33).cast::<u8>());
5780                                                                                        l14 as u8
5781                                                                                    };
5782                                                                                    Some(e)
5783                                                                                }
5784                                                                                _ => _rt::invalid_enum_discriminant(),
5785                                                                            },
5786                                                                            alert_message: match l15 {
5787                                                                                0 => None,
5788                                                                                1 => {
5789                                                                                    let e = {
5790                                                                                        let l16 = *ptr0
5791                                                                                            .add(32 + 2 * ::core::mem::size_of::<*const u8>())
5792                                                                                            .cast::<*mut u8>();
5793                                                                                        let l17 = *ptr0
5794                                                                                            .add(32 + 3 * ::core::mem::size_of::<*const u8>())
5795                                                                                            .cast::<usize>();
5796                                                                                        let len18 = l17;
5797                                                                                        let bytes18 = _rt::Vec::from_raw_parts(
5798                                                                                            l16.cast(),
5799                                                                                            len18,
5800                                                                                            len18,
5801                                                                                        );
5802                                                                                        _rt::string_lift(bytes18)
5803                                                                                    };
5804                                                                                    Some(e)
5805                                                                                }
5806                                                                                _ => _rt::invalid_enum_discriminant(),
5807                                                                            },
5808                                                                        }
5809                                                                    };
5810                                                                    ErrorCode::TlsAlertReceived(e68)
5811                                                                }
5812                                                                15 => ErrorCode::HttpRequestDenied,
5813                                                                16 => ErrorCode::HttpRequestLengthRequired,
5814                                                                17 => {
5815                                                                    let e68 = {
5816                                                                        let l19 = i32::from(*ptr0.add(32).cast::<u8>());
5817                                                                        match l19 {
5818                                                                            0 => None,
5819                                                                            1 => {
5820                                                                                let e = {
5821                                                                                    let l20 = *ptr0.add(40).cast::<i64>();
5822                                                                                    l20 as u64
5823                                                                                };
5824                                                                                Some(e)
5825                                                                            }
5826                                                                            _ => _rt::invalid_enum_discriminant(),
5827                                                                        }
5828                                                                    };
5829                                                                    ErrorCode::HttpRequestBodySize(e68)
5830                                                                }
5831                                                                18 => ErrorCode::HttpRequestMethodInvalid,
5832                                                                19 => ErrorCode::HttpRequestUriInvalid,
5833                                                                20 => ErrorCode::HttpRequestUriTooLong,
5834                                                                21 => {
5835                                                                    let e68 = {
5836                                                                        let l21 = i32::from(*ptr0.add(32).cast::<u8>());
5837                                                                        match l21 {
5838                                                                            0 => None,
5839                                                                            1 => {
5840                                                                                let e = {
5841                                                                                    let l22 = *ptr0.add(36).cast::<i32>();
5842                                                                                    l22 as u32
5843                                                                                };
5844                                                                                Some(e)
5845                                                                            }
5846                                                                            _ => _rt::invalid_enum_discriminant(),
5847                                                                        }
5848                                                                    };
5849                                                                    ErrorCode::HttpRequestHeaderSectionSize(e68)
5850                                                                }
5851                                                                22 => {
5852                                                                    let e68 = {
5853                                                                        let l23 = i32::from(*ptr0.add(32).cast::<u8>());
5854                                                                        match l23 {
5855                                                                            0 => None,
5856                                                                            1 => {
5857                                                                                let e = {
5858                                                                                    let l24 = i32::from(
5859                                                                                        *ptr0
5860                                                                                            .add(32 + 1 * ::core::mem::size_of::<*const u8>())
5861                                                                                            .cast::<u8>(),
5862                                                                                    );
5863                                                                                    let l28 = i32::from(
5864                                                                                        *ptr0
5865                                                                                            .add(32 + 4 * ::core::mem::size_of::<*const u8>())
5866                                                                                            .cast::<u8>(),
5867                                                                                    );
5868                                                                                    FieldSizePayload {
5869                                                                                        field_name: match l24 {
5870                                                                                            0 => None,
5871                                                                                            1 => {
5872                                                                                                let e = {
5873                                                                                                    let l25 = *ptr0
5874                                                                                                        .add(32 + 2 * ::core::mem::size_of::<*const u8>())
5875                                                                                                        .cast::<*mut u8>();
5876                                                                                                    let l26 = *ptr0
5877                                                                                                        .add(32 + 3 * ::core::mem::size_of::<*const u8>())
5878                                                                                                        .cast::<usize>();
5879                                                                                                    let len27 = l26;
5880                                                                                                    let bytes27 = _rt::Vec::from_raw_parts(
5881                                                                                                        l25.cast(),
5882                                                                                                        len27,
5883                                                                                                        len27,
5884                                                                                                    );
5885                                                                                                    _rt::string_lift(bytes27)
5886                                                                                                };
5887                                                                                                Some(e)
5888                                                                                            }
5889                                                                                            _ => _rt::invalid_enum_discriminant(),
5890                                                                                        },
5891                                                                                        field_size: match l28 {
5892                                                                                            0 => None,
5893                                                                                            1 => {
5894                                                                                                let e = {
5895                                                                                                    let l29 = *ptr0
5896                                                                                                        .add(36 + 4 * ::core::mem::size_of::<*const u8>())
5897                                                                                                        .cast::<i32>();
5898                                                                                                    l29 as u32
5899                                                                                                };
5900                                                                                                Some(e)
5901                                                                                            }
5902                                                                                            _ => _rt::invalid_enum_discriminant(),
5903                                                                                        },
5904                                                                                    }
5905                                                                                };
5906                                                                                Some(e)
5907                                                                            }
5908                                                                            _ => _rt::invalid_enum_discriminant(),
5909                                                                        }
5910                                                                    };
5911                                                                    ErrorCode::HttpRequestHeaderSize(e68)
5912                                                                }
5913                                                                23 => {
5914                                                                    let e68 = {
5915                                                                        let l30 = i32::from(*ptr0.add(32).cast::<u8>());
5916                                                                        match l30 {
5917                                                                            0 => None,
5918                                                                            1 => {
5919                                                                                let e = {
5920                                                                                    let l31 = *ptr0.add(36).cast::<i32>();
5921                                                                                    l31 as u32
5922                                                                                };
5923                                                                                Some(e)
5924                                                                            }
5925                                                                            _ => _rt::invalid_enum_discriminant(),
5926                                                                        }
5927                                                                    };
5928                                                                    ErrorCode::HttpRequestTrailerSectionSize(e68)
5929                                                                }
5930                                                                24 => {
5931                                                                    let e68 = {
5932                                                                        let l32 = i32::from(*ptr0.add(32).cast::<u8>());
5933                                                                        let l36 = i32::from(
5934                                                                            *ptr0
5935                                                                                .add(32 + 3 * ::core::mem::size_of::<*const u8>())
5936                                                                                .cast::<u8>(),
5937                                                                        );
5938                                                                        FieldSizePayload {
5939                                                                            field_name: match l32 {
5940                                                                                0 => None,
5941                                                                                1 => {
5942                                                                                    let e = {
5943                                                                                        let l33 = *ptr0
5944                                                                                            .add(32 + 1 * ::core::mem::size_of::<*const u8>())
5945                                                                                            .cast::<*mut u8>();
5946                                                                                        let l34 = *ptr0
5947                                                                                            .add(32 + 2 * ::core::mem::size_of::<*const u8>())
5948                                                                                            .cast::<usize>();
5949                                                                                        let len35 = l34;
5950                                                                                        let bytes35 = _rt::Vec::from_raw_parts(
5951                                                                                            l33.cast(),
5952                                                                                            len35,
5953                                                                                            len35,
5954                                                                                        );
5955                                                                                        _rt::string_lift(bytes35)
5956                                                                                    };
5957                                                                                    Some(e)
5958                                                                                }
5959                                                                                _ => _rt::invalid_enum_discriminant(),
5960                                                                            },
5961                                                                            field_size: match l36 {
5962                                                                                0 => None,
5963                                                                                1 => {
5964                                                                                    let e = {
5965                                                                                        let l37 = *ptr0
5966                                                                                            .add(36 + 3 * ::core::mem::size_of::<*const u8>())
5967                                                                                            .cast::<i32>();
5968                                                                                        l37 as u32
5969                                                                                    };
5970                                                                                    Some(e)
5971                                                                                }
5972                                                                                _ => _rt::invalid_enum_discriminant(),
5973                                                                            },
5974                                                                        }
5975                                                                    };
5976                                                                    ErrorCode::HttpRequestTrailerSize(e68)
5977                                                                }
5978                                                                25 => ErrorCode::HttpResponseIncomplete,
5979                                                                26 => {
5980                                                                    let e68 = {
5981                                                                        let l38 = i32::from(*ptr0.add(32).cast::<u8>());
5982                                                                        match l38 {
5983                                                                            0 => None,
5984                                                                            1 => {
5985                                                                                let e = {
5986                                                                                    let l39 = *ptr0.add(36).cast::<i32>();
5987                                                                                    l39 as u32
5988                                                                                };
5989                                                                                Some(e)
5990                                                                            }
5991                                                                            _ => _rt::invalid_enum_discriminant(),
5992                                                                        }
5993                                                                    };
5994                                                                    ErrorCode::HttpResponseHeaderSectionSize(e68)
5995                                                                }
5996                                                                27 => {
5997                                                                    let e68 = {
5998                                                                        let l40 = i32::from(*ptr0.add(32).cast::<u8>());
5999                                                                        let l44 = i32::from(
6000                                                                            *ptr0
6001                                                                                .add(32 + 3 * ::core::mem::size_of::<*const u8>())
6002                                                                                .cast::<u8>(),
6003                                                                        );
6004                                                                        FieldSizePayload {
6005                                                                            field_name: match l40 {
6006                                                                                0 => None,
6007                                                                                1 => {
6008                                                                                    let e = {
6009                                                                                        let l41 = *ptr0
6010                                                                                            .add(32 + 1 * ::core::mem::size_of::<*const u8>())
6011                                                                                            .cast::<*mut u8>();
6012                                                                                        let l42 = *ptr0
6013                                                                                            .add(32 + 2 * ::core::mem::size_of::<*const u8>())
6014                                                                                            .cast::<usize>();
6015                                                                                        let len43 = l42;
6016                                                                                        let bytes43 = _rt::Vec::from_raw_parts(
6017                                                                                            l41.cast(),
6018                                                                                            len43,
6019                                                                                            len43,
6020                                                                                        );
6021                                                                                        _rt::string_lift(bytes43)
6022                                                                                    };
6023                                                                                    Some(e)
6024                                                                                }
6025                                                                                _ => _rt::invalid_enum_discriminant(),
6026                                                                            },
6027                                                                            field_size: match l44 {
6028                                                                                0 => None,
6029                                                                                1 => {
6030                                                                                    let e = {
6031                                                                                        let l45 = *ptr0
6032                                                                                            .add(36 + 3 * ::core::mem::size_of::<*const u8>())
6033                                                                                            .cast::<i32>();
6034                                                                                        l45 as u32
6035                                                                                    };
6036                                                                                    Some(e)
6037                                                                                }
6038                                                                                _ => _rt::invalid_enum_discriminant(),
6039                                                                            },
6040                                                                        }
6041                                                                    };
6042                                                                    ErrorCode::HttpResponseHeaderSize(e68)
6043                                                                }
6044                                                                28 => {
6045                                                                    let e68 = {
6046                                                                        let l46 = i32::from(*ptr0.add(32).cast::<u8>());
6047                                                                        match l46 {
6048                                                                            0 => None,
6049                                                                            1 => {
6050                                                                                let e = {
6051                                                                                    let l47 = *ptr0.add(40).cast::<i64>();
6052                                                                                    l47 as u64
6053                                                                                };
6054                                                                                Some(e)
6055                                                                            }
6056                                                                            _ => _rt::invalid_enum_discriminant(),
6057                                                                        }
6058                                                                    };
6059                                                                    ErrorCode::HttpResponseBodySize(e68)
6060                                                                }
6061                                                                29 => {
6062                                                                    let e68 = {
6063                                                                        let l48 = i32::from(*ptr0.add(32).cast::<u8>());
6064                                                                        match l48 {
6065                                                                            0 => None,
6066                                                                            1 => {
6067                                                                                let e = {
6068                                                                                    let l49 = *ptr0.add(36).cast::<i32>();
6069                                                                                    l49 as u32
6070                                                                                };
6071                                                                                Some(e)
6072                                                                            }
6073                                                                            _ => _rt::invalid_enum_discriminant(),
6074                                                                        }
6075                                                                    };
6076                                                                    ErrorCode::HttpResponseTrailerSectionSize(e68)
6077                                                                }
6078                                                                30 => {
6079                                                                    let e68 = {
6080                                                                        let l50 = i32::from(*ptr0.add(32).cast::<u8>());
6081                                                                        let l54 = i32::from(
6082                                                                            *ptr0
6083                                                                                .add(32 + 3 * ::core::mem::size_of::<*const u8>())
6084                                                                                .cast::<u8>(),
6085                                                                        );
6086                                                                        FieldSizePayload {
6087                                                                            field_name: match l50 {
6088                                                                                0 => None,
6089                                                                                1 => {
6090                                                                                    let e = {
6091                                                                                        let l51 = *ptr0
6092                                                                                            .add(32 + 1 * ::core::mem::size_of::<*const u8>())
6093                                                                                            .cast::<*mut u8>();
6094                                                                                        let l52 = *ptr0
6095                                                                                            .add(32 + 2 * ::core::mem::size_of::<*const u8>())
6096                                                                                            .cast::<usize>();
6097                                                                                        let len53 = l52;
6098                                                                                        let bytes53 = _rt::Vec::from_raw_parts(
6099                                                                                            l51.cast(),
6100                                                                                            len53,
6101                                                                                            len53,
6102                                                                                        );
6103                                                                                        _rt::string_lift(bytes53)
6104                                                                                    };
6105                                                                                    Some(e)
6106                                                                                }
6107                                                                                _ => _rt::invalid_enum_discriminant(),
6108                                                                            },
6109                                                                            field_size: match l54 {
6110                                                                                0 => None,
6111                                                                                1 => {
6112                                                                                    let e = {
6113                                                                                        let l55 = *ptr0
6114                                                                                            .add(36 + 3 * ::core::mem::size_of::<*const u8>())
6115                                                                                            .cast::<i32>();
6116                                                                                        l55 as u32
6117                                                                                    };
6118                                                                                    Some(e)
6119                                                                                }
6120                                                                                _ => _rt::invalid_enum_discriminant(),
6121                                                                            },
6122                                                                        }
6123                                                                    };
6124                                                                    ErrorCode::HttpResponseTrailerSize(e68)
6125                                                                }
6126                                                                31 => {
6127                                                                    let e68 = {
6128                                                                        let l56 = i32::from(*ptr0.add(32).cast::<u8>());
6129                                                                        match l56 {
6130                                                                            0 => None,
6131                                                                            1 => {
6132                                                                                let e = {
6133                                                                                    let l57 = *ptr0
6134                                                                                        .add(32 + 1 * ::core::mem::size_of::<*const u8>())
6135                                                                                        .cast::<*mut u8>();
6136                                                                                    let l58 = *ptr0
6137                                                                                        .add(32 + 2 * ::core::mem::size_of::<*const u8>())
6138                                                                                        .cast::<usize>();
6139                                                                                    let len59 = l58;
6140                                                                                    let bytes59 = _rt::Vec::from_raw_parts(
6141                                                                                        l57.cast(),
6142                                                                                        len59,
6143                                                                                        len59,
6144                                                                                    );
6145                                                                                    _rt::string_lift(bytes59)
6146                                                                                };
6147                                                                                Some(e)
6148                                                                            }
6149                                                                            _ => _rt::invalid_enum_discriminant(),
6150                                                                        }
6151                                                                    };
6152                                                                    ErrorCode::HttpResponseTransferCoding(e68)
6153                                                                }
6154                                                                32 => {
6155                                                                    let e68 = {
6156                                                                        let l60 = i32::from(*ptr0.add(32).cast::<u8>());
6157                                                                        match l60 {
6158                                                                            0 => None,
6159                                                                            1 => {
6160                                                                                let e = {
6161                                                                                    let l61 = *ptr0
6162                                                                                        .add(32 + 1 * ::core::mem::size_of::<*const u8>())
6163                                                                                        .cast::<*mut u8>();
6164                                                                                    let l62 = *ptr0
6165                                                                                        .add(32 + 2 * ::core::mem::size_of::<*const u8>())
6166                                                                                        .cast::<usize>();
6167                                                                                    let len63 = l62;
6168                                                                                    let bytes63 = _rt::Vec::from_raw_parts(
6169                                                                                        l61.cast(),
6170                                                                                        len63,
6171                                                                                        len63,
6172                                                                                    );
6173                                                                                    _rt::string_lift(bytes63)
6174                                                                                };
6175                                                                                Some(e)
6176                                                                            }
6177                                                                            _ => _rt::invalid_enum_discriminant(),
6178                                                                        }
6179                                                                    };
6180                                                                    ErrorCode::HttpResponseContentCoding(e68)
6181                                                                }
6182                                                                33 => ErrorCode::HttpResponseTimeout,
6183                                                                34 => ErrorCode::HttpUpgradeFailed,
6184                                                                35 => ErrorCode::HttpProtocolError,
6185                                                                36 => ErrorCode::LoopDetected,
6186                                                                37 => ErrorCode::ConfigurationError,
6187                                                                n => {
6188                                                                    debug_assert_eq!(n, 38, "invalid enum discriminant");
6189                                                                    let e68 = {
6190                                                                        let l64 = i32::from(*ptr0.add(32).cast::<u8>());
6191                                                                        match l64 {
6192                                                                            0 => None,
6193                                                                            1 => {
6194                                                                                let e = {
6195                                                                                    let l65 = *ptr0
6196                                                                                        .add(32 + 1 * ::core::mem::size_of::<*const u8>())
6197                                                                                        .cast::<*mut u8>();
6198                                                                                    let l66 = *ptr0
6199                                                                                        .add(32 + 2 * ::core::mem::size_of::<*const u8>())
6200                                                                                        .cast::<usize>();
6201                                                                                    let len67 = l66;
6202                                                                                    let bytes67 = _rt::Vec::from_raw_parts(
6203                                                                                        l65.cast(),
6204                                                                                        len67,
6205                                                                                        len67,
6206                                                                                    );
6207                                                                                    _rt::string_lift(bytes67)
6208                                                                                };
6209                                                                                Some(e)
6210                                                                            }
6211                                                                            _ => _rt::invalid_enum_discriminant(),
6212                                                                        }
6213                                                                    };
6214                                                                    ErrorCode::InternalError(e68)
6215                                                                }
6216                                                            };
6217                                                            v68
6218                                                        };
6219                                                        Err(e)
6220                                                    }
6221                                                    _ => _rt::invalid_enum_discriminant(),
6222                                                }
6223                                            };
6224                                            Ok(e)
6225                                        }
6226                                        1 => {
6227                                            let e = ();
6228                                            Err(e)
6229                                        }
6230                                        _ => _rt::invalid_enum_discriminant(),
6231                                    }
6232                                };
6233                                Some(e)
6234                            }
6235                            _ => _rt::invalid_enum_discriminant(),
6236                        };
6237                        result69
6238                    }
6239                }
6240            }
6241        }
6242        /// This interface defines a handler of outgoing HTTP Requests. It should be
6243        /// imported by components which wish to make HTTP Requests.
6244        #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
6245        pub mod outgoing_handler {
6246            #[used]
6247            #[doc(hidden)]
6248            static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports;
6249            use super::super::super::_rt;
6250            pub type OutgoingRequest = super::super::super::wasi::http::types::OutgoingRequest;
6251            pub type RequestOptions = super::super::super::wasi::http::types::RequestOptions;
6252            pub type FutureIncomingResponse = super::super::super::wasi::http::types::FutureIncomingResponse;
6253            pub type ErrorCode = super::super::super::wasi::http::types::ErrorCode;
6254            #[allow(unused_unsafe, clippy::all)]
6255            /// This function is invoked with an outgoing HTTP Request, and it returns
6256            /// a resource `future-incoming-response` which represents an HTTP Response
6257            /// which may arrive in the future.
6258            ///
6259            /// The `options` argument accepts optional parameters for the HTTP
6260            /// protocol's transport layer.
6261            ///
6262            /// This function may return an error if the `outgoing-request` is invalid
6263            /// or not allowed to be made. Otherwise, protocol errors are reported
6264            /// through the `future-incoming-response`.
6265            #[allow(async_fn_in_trait)]
6266            pub fn handle(
6267                request: OutgoingRequest,
6268                options: Option<RequestOptions>,
6269            ) -> Result<FutureIncomingResponse, ErrorCode> {
6270                unsafe {
6271                    #[repr(align(8))]
6272                    struct RetArea(
6273                        [::core::mem::MaybeUninit<
6274                            u8,
6275                        >; 24 + 4 * ::core::mem::size_of::<*const u8>()],
6276                    );
6277                    let mut ret_area = RetArea(
6278                        [::core::mem::MaybeUninit::uninit(); 24
6279                            + 4 * ::core::mem::size_of::<*const u8>()],
6280                    );
6281                    let (result0_0, result0_1) = match &options {
6282                        Some(e) => (1i32, (e).take_handle() as i32),
6283                        None => (0i32, 0i32),
6284                    };
6285                    let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
6286                    #[cfg(target_arch = "wasm32")]
6287                    #[link(wasm_import_module = "wasi:http/outgoing-handler@0.2.4")]
6288                    unsafe extern "C" {
6289                        #[link_name = "handle"]
6290                        fn wit_import2(_: i32, _: i32, _: i32, _: *mut u8);
6291                    }
6292                    #[cfg(not(target_arch = "wasm32"))]
6293                    unsafe extern "C" fn wit_import2(
6294                        _: i32,
6295                        _: i32,
6296                        _: i32,
6297                        _: *mut u8,
6298                    ) {
6299                        unreachable!()
6300                    }
6301                    wit_import2(
6302                        (&request).take_handle() as i32,
6303                        result0_0,
6304                        result0_1,
6305                        ptr1,
6306                    );
6307                    let l3 = i32::from(*ptr1.add(0).cast::<u8>());
6308                    let result68 = match l3 {
6309                        0 => {
6310                            let e = {
6311                                let l4 = *ptr1.add(8).cast::<i32>();
6312                                super::super::super::wasi::http::types::FutureIncomingResponse::from_handle(
6313                                    l4 as u32,
6314                                )
6315                            };
6316                            Ok(e)
6317                        }
6318                        1 => {
6319                            let e = {
6320                                let l5 = i32::from(*ptr1.add(8).cast::<u8>());
6321                                use super::super::super::wasi::http::types::ErrorCode as V67;
6322                                let v67 = match l5 {
6323                                    0 => V67::DnsTimeout,
6324                                    1 => {
6325                                        let e67 = {
6326                                            let l6 = i32::from(*ptr1.add(16).cast::<u8>());
6327                                            let l10 = i32::from(
6328                                                *ptr1
6329                                                    .add(16 + 3 * ::core::mem::size_of::<*const u8>())
6330                                                    .cast::<u8>(),
6331                                            );
6332                                            super::super::super::wasi::http::types::DnsErrorPayload {
6333                                                rcode: match l6 {
6334                                                    0 => None,
6335                                                    1 => {
6336                                                        let e = {
6337                                                            let l7 = *ptr1
6338                                                                .add(16 + 1 * ::core::mem::size_of::<*const u8>())
6339                                                                .cast::<*mut u8>();
6340                                                            let l8 = *ptr1
6341                                                                .add(16 + 2 * ::core::mem::size_of::<*const u8>())
6342                                                                .cast::<usize>();
6343                                                            let len9 = l8;
6344                                                            let bytes9 = _rt::Vec::from_raw_parts(
6345                                                                l7.cast(),
6346                                                                len9,
6347                                                                len9,
6348                                                            );
6349                                                            _rt::string_lift(bytes9)
6350                                                        };
6351                                                        Some(e)
6352                                                    }
6353                                                    _ => _rt::invalid_enum_discriminant(),
6354                                                },
6355                                                info_code: match l10 {
6356                                                    0 => None,
6357                                                    1 => {
6358                                                        let e = {
6359                                                            let l11 = i32::from(
6360                                                                *ptr1
6361                                                                    .add(18 + 3 * ::core::mem::size_of::<*const u8>())
6362                                                                    .cast::<u16>(),
6363                                                            );
6364                                                            l11 as u16
6365                                                        };
6366                                                        Some(e)
6367                                                    }
6368                                                    _ => _rt::invalid_enum_discriminant(),
6369                                                },
6370                                            }
6371                                        };
6372                                        V67::DnsError(e67)
6373                                    }
6374                                    2 => V67::DestinationNotFound,
6375                                    3 => V67::DestinationUnavailable,
6376                                    4 => V67::DestinationIpProhibited,
6377                                    5 => V67::DestinationIpUnroutable,
6378                                    6 => V67::ConnectionRefused,
6379                                    7 => V67::ConnectionTerminated,
6380                                    8 => V67::ConnectionTimeout,
6381                                    9 => V67::ConnectionReadTimeout,
6382                                    10 => V67::ConnectionWriteTimeout,
6383                                    11 => V67::ConnectionLimitReached,
6384                                    12 => V67::TlsProtocolError,
6385                                    13 => V67::TlsCertificateError,
6386                                    14 => {
6387                                        let e67 = {
6388                                            let l12 = i32::from(*ptr1.add(16).cast::<u8>());
6389                                            let l14 = i32::from(
6390                                                *ptr1
6391                                                    .add(16 + 1 * ::core::mem::size_of::<*const u8>())
6392                                                    .cast::<u8>(),
6393                                            );
6394                                            super::super::super::wasi::http::types::TlsAlertReceivedPayload {
6395                                                alert_id: match l12 {
6396                                                    0 => None,
6397                                                    1 => {
6398                                                        let e = {
6399                                                            let l13 = i32::from(*ptr1.add(17).cast::<u8>());
6400                                                            l13 as u8
6401                                                        };
6402                                                        Some(e)
6403                                                    }
6404                                                    _ => _rt::invalid_enum_discriminant(),
6405                                                },
6406                                                alert_message: match l14 {
6407                                                    0 => None,
6408                                                    1 => {
6409                                                        let e = {
6410                                                            let l15 = *ptr1
6411                                                                .add(16 + 2 * ::core::mem::size_of::<*const u8>())
6412                                                                .cast::<*mut u8>();
6413                                                            let l16 = *ptr1
6414                                                                .add(16 + 3 * ::core::mem::size_of::<*const u8>())
6415                                                                .cast::<usize>();
6416                                                            let len17 = l16;
6417                                                            let bytes17 = _rt::Vec::from_raw_parts(
6418                                                                l15.cast(),
6419                                                                len17,
6420                                                                len17,
6421                                                            );
6422                                                            _rt::string_lift(bytes17)
6423                                                        };
6424                                                        Some(e)
6425                                                    }
6426                                                    _ => _rt::invalid_enum_discriminant(),
6427                                                },
6428                                            }
6429                                        };
6430                                        V67::TlsAlertReceived(e67)
6431                                    }
6432                                    15 => V67::HttpRequestDenied,
6433                                    16 => V67::HttpRequestLengthRequired,
6434                                    17 => {
6435                                        let e67 = {
6436                                            let l18 = i32::from(*ptr1.add(16).cast::<u8>());
6437                                            match l18 {
6438                                                0 => None,
6439                                                1 => {
6440                                                    let e = {
6441                                                        let l19 = *ptr1.add(24).cast::<i64>();
6442                                                        l19 as u64
6443                                                    };
6444                                                    Some(e)
6445                                                }
6446                                                _ => _rt::invalid_enum_discriminant(),
6447                                            }
6448                                        };
6449                                        V67::HttpRequestBodySize(e67)
6450                                    }
6451                                    18 => V67::HttpRequestMethodInvalid,
6452                                    19 => V67::HttpRequestUriInvalid,
6453                                    20 => V67::HttpRequestUriTooLong,
6454                                    21 => {
6455                                        let e67 = {
6456                                            let l20 = i32::from(*ptr1.add(16).cast::<u8>());
6457                                            match l20 {
6458                                                0 => None,
6459                                                1 => {
6460                                                    let e = {
6461                                                        let l21 = *ptr1.add(20).cast::<i32>();
6462                                                        l21 as u32
6463                                                    };
6464                                                    Some(e)
6465                                                }
6466                                                _ => _rt::invalid_enum_discriminant(),
6467                                            }
6468                                        };
6469                                        V67::HttpRequestHeaderSectionSize(e67)
6470                                    }
6471                                    22 => {
6472                                        let e67 = {
6473                                            let l22 = i32::from(*ptr1.add(16).cast::<u8>());
6474                                            match l22 {
6475                                                0 => None,
6476                                                1 => {
6477                                                    let e = {
6478                                                        let l23 = i32::from(
6479                                                            *ptr1
6480                                                                .add(16 + 1 * ::core::mem::size_of::<*const u8>())
6481                                                                .cast::<u8>(),
6482                                                        );
6483                                                        let l27 = i32::from(
6484                                                            *ptr1
6485                                                                .add(16 + 4 * ::core::mem::size_of::<*const u8>())
6486                                                                .cast::<u8>(),
6487                                                        );
6488                                                        super::super::super::wasi::http::types::FieldSizePayload {
6489                                                            field_name: match l23 {
6490                                                                0 => None,
6491                                                                1 => {
6492                                                                    let e = {
6493                                                                        let l24 = *ptr1
6494                                                                            .add(16 + 2 * ::core::mem::size_of::<*const u8>())
6495                                                                            .cast::<*mut u8>();
6496                                                                        let l25 = *ptr1
6497                                                                            .add(16 + 3 * ::core::mem::size_of::<*const u8>())
6498                                                                            .cast::<usize>();
6499                                                                        let len26 = l25;
6500                                                                        let bytes26 = _rt::Vec::from_raw_parts(
6501                                                                            l24.cast(),
6502                                                                            len26,
6503                                                                            len26,
6504                                                                        );
6505                                                                        _rt::string_lift(bytes26)
6506                                                                    };
6507                                                                    Some(e)
6508                                                                }
6509                                                                _ => _rt::invalid_enum_discriminant(),
6510                                                            },
6511                                                            field_size: match l27 {
6512                                                                0 => None,
6513                                                                1 => {
6514                                                                    let e = {
6515                                                                        let l28 = *ptr1
6516                                                                            .add(20 + 4 * ::core::mem::size_of::<*const u8>())
6517                                                                            .cast::<i32>();
6518                                                                        l28 as u32
6519                                                                    };
6520                                                                    Some(e)
6521                                                                }
6522                                                                _ => _rt::invalid_enum_discriminant(),
6523                                                            },
6524                                                        }
6525                                                    };
6526                                                    Some(e)
6527                                                }
6528                                                _ => _rt::invalid_enum_discriminant(),
6529                                            }
6530                                        };
6531                                        V67::HttpRequestHeaderSize(e67)
6532                                    }
6533                                    23 => {
6534                                        let e67 = {
6535                                            let l29 = i32::from(*ptr1.add(16).cast::<u8>());
6536                                            match l29 {
6537                                                0 => None,
6538                                                1 => {
6539                                                    let e = {
6540                                                        let l30 = *ptr1.add(20).cast::<i32>();
6541                                                        l30 as u32
6542                                                    };
6543                                                    Some(e)
6544                                                }
6545                                                _ => _rt::invalid_enum_discriminant(),
6546                                            }
6547                                        };
6548                                        V67::HttpRequestTrailerSectionSize(e67)
6549                                    }
6550                                    24 => {
6551                                        let e67 = {
6552                                            let l31 = i32::from(*ptr1.add(16).cast::<u8>());
6553                                            let l35 = i32::from(
6554                                                *ptr1
6555                                                    .add(16 + 3 * ::core::mem::size_of::<*const u8>())
6556                                                    .cast::<u8>(),
6557                                            );
6558                                            super::super::super::wasi::http::types::FieldSizePayload {
6559                                                field_name: match l31 {
6560                                                    0 => None,
6561                                                    1 => {
6562                                                        let e = {
6563                                                            let l32 = *ptr1
6564                                                                .add(16 + 1 * ::core::mem::size_of::<*const u8>())
6565                                                                .cast::<*mut u8>();
6566                                                            let l33 = *ptr1
6567                                                                .add(16 + 2 * ::core::mem::size_of::<*const u8>())
6568                                                                .cast::<usize>();
6569                                                            let len34 = l33;
6570                                                            let bytes34 = _rt::Vec::from_raw_parts(
6571                                                                l32.cast(),
6572                                                                len34,
6573                                                                len34,
6574                                                            );
6575                                                            _rt::string_lift(bytes34)
6576                                                        };
6577                                                        Some(e)
6578                                                    }
6579                                                    _ => _rt::invalid_enum_discriminant(),
6580                                                },
6581                                                field_size: match l35 {
6582                                                    0 => None,
6583                                                    1 => {
6584                                                        let e = {
6585                                                            let l36 = *ptr1
6586                                                                .add(20 + 3 * ::core::mem::size_of::<*const u8>())
6587                                                                .cast::<i32>();
6588                                                            l36 as u32
6589                                                        };
6590                                                        Some(e)
6591                                                    }
6592                                                    _ => _rt::invalid_enum_discriminant(),
6593                                                },
6594                                            }
6595                                        };
6596                                        V67::HttpRequestTrailerSize(e67)
6597                                    }
6598                                    25 => V67::HttpResponseIncomplete,
6599                                    26 => {
6600                                        let e67 = {
6601                                            let l37 = i32::from(*ptr1.add(16).cast::<u8>());
6602                                            match l37 {
6603                                                0 => None,
6604                                                1 => {
6605                                                    let e = {
6606                                                        let l38 = *ptr1.add(20).cast::<i32>();
6607                                                        l38 as u32
6608                                                    };
6609                                                    Some(e)
6610                                                }
6611                                                _ => _rt::invalid_enum_discriminant(),
6612                                            }
6613                                        };
6614                                        V67::HttpResponseHeaderSectionSize(e67)
6615                                    }
6616                                    27 => {
6617                                        let e67 = {
6618                                            let l39 = i32::from(*ptr1.add(16).cast::<u8>());
6619                                            let l43 = i32::from(
6620                                                *ptr1
6621                                                    .add(16 + 3 * ::core::mem::size_of::<*const u8>())
6622                                                    .cast::<u8>(),
6623                                            );
6624                                            super::super::super::wasi::http::types::FieldSizePayload {
6625                                                field_name: match l39 {
6626                                                    0 => None,
6627                                                    1 => {
6628                                                        let e = {
6629                                                            let l40 = *ptr1
6630                                                                .add(16 + 1 * ::core::mem::size_of::<*const u8>())
6631                                                                .cast::<*mut u8>();
6632                                                            let l41 = *ptr1
6633                                                                .add(16 + 2 * ::core::mem::size_of::<*const u8>())
6634                                                                .cast::<usize>();
6635                                                            let len42 = l41;
6636                                                            let bytes42 = _rt::Vec::from_raw_parts(
6637                                                                l40.cast(),
6638                                                                len42,
6639                                                                len42,
6640                                                            );
6641                                                            _rt::string_lift(bytes42)
6642                                                        };
6643                                                        Some(e)
6644                                                    }
6645                                                    _ => _rt::invalid_enum_discriminant(),
6646                                                },
6647                                                field_size: match l43 {
6648                                                    0 => None,
6649                                                    1 => {
6650                                                        let e = {
6651                                                            let l44 = *ptr1
6652                                                                .add(20 + 3 * ::core::mem::size_of::<*const u8>())
6653                                                                .cast::<i32>();
6654                                                            l44 as u32
6655                                                        };
6656                                                        Some(e)
6657                                                    }
6658                                                    _ => _rt::invalid_enum_discriminant(),
6659                                                },
6660                                            }
6661                                        };
6662                                        V67::HttpResponseHeaderSize(e67)
6663                                    }
6664                                    28 => {
6665                                        let e67 = {
6666                                            let l45 = i32::from(*ptr1.add(16).cast::<u8>());
6667                                            match l45 {
6668                                                0 => None,
6669                                                1 => {
6670                                                    let e = {
6671                                                        let l46 = *ptr1.add(24).cast::<i64>();
6672                                                        l46 as u64
6673                                                    };
6674                                                    Some(e)
6675                                                }
6676                                                _ => _rt::invalid_enum_discriminant(),
6677                                            }
6678                                        };
6679                                        V67::HttpResponseBodySize(e67)
6680                                    }
6681                                    29 => {
6682                                        let e67 = {
6683                                            let l47 = i32::from(*ptr1.add(16).cast::<u8>());
6684                                            match l47 {
6685                                                0 => None,
6686                                                1 => {
6687                                                    let e = {
6688                                                        let l48 = *ptr1.add(20).cast::<i32>();
6689                                                        l48 as u32
6690                                                    };
6691                                                    Some(e)
6692                                                }
6693                                                _ => _rt::invalid_enum_discriminant(),
6694                                            }
6695                                        };
6696                                        V67::HttpResponseTrailerSectionSize(e67)
6697                                    }
6698                                    30 => {
6699                                        let e67 = {
6700                                            let l49 = i32::from(*ptr1.add(16).cast::<u8>());
6701                                            let l53 = i32::from(
6702                                                *ptr1
6703                                                    .add(16 + 3 * ::core::mem::size_of::<*const u8>())
6704                                                    .cast::<u8>(),
6705                                            );
6706                                            super::super::super::wasi::http::types::FieldSizePayload {
6707                                                field_name: match l49 {
6708                                                    0 => None,
6709                                                    1 => {
6710                                                        let e = {
6711                                                            let l50 = *ptr1
6712                                                                .add(16 + 1 * ::core::mem::size_of::<*const u8>())
6713                                                                .cast::<*mut u8>();
6714                                                            let l51 = *ptr1
6715                                                                .add(16 + 2 * ::core::mem::size_of::<*const u8>())
6716                                                                .cast::<usize>();
6717                                                            let len52 = l51;
6718                                                            let bytes52 = _rt::Vec::from_raw_parts(
6719                                                                l50.cast(),
6720                                                                len52,
6721                                                                len52,
6722                                                            );
6723                                                            _rt::string_lift(bytes52)
6724                                                        };
6725                                                        Some(e)
6726                                                    }
6727                                                    _ => _rt::invalid_enum_discriminant(),
6728                                                },
6729                                                field_size: match l53 {
6730                                                    0 => None,
6731                                                    1 => {
6732                                                        let e = {
6733                                                            let l54 = *ptr1
6734                                                                .add(20 + 3 * ::core::mem::size_of::<*const u8>())
6735                                                                .cast::<i32>();
6736                                                            l54 as u32
6737                                                        };
6738                                                        Some(e)
6739                                                    }
6740                                                    _ => _rt::invalid_enum_discriminant(),
6741                                                },
6742                                            }
6743                                        };
6744                                        V67::HttpResponseTrailerSize(e67)
6745                                    }
6746                                    31 => {
6747                                        let e67 = {
6748                                            let l55 = i32::from(*ptr1.add(16).cast::<u8>());
6749                                            match l55 {
6750                                                0 => None,
6751                                                1 => {
6752                                                    let e = {
6753                                                        let l56 = *ptr1
6754                                                            .add(16 + 1 * ::core::mem::size_of::<*const u8>())
6755                                                            .cast::<*mut u8>();
6756                                                        let l57 = *ptr1
6757                                                            .add(16 + 2 * ::core::mem::size_of::<*const u8>())
6758                                                            .cast::<usize>();
6759                                                        let len58 = l57;
6760                                                        let bytes58 = _rt::Vec::from_raw_parts(
6761                                                            l56.cast(),
6762                                                            len58,
6763                                                            len58,
6764                                                        );
6765                                                        _rt::string_lift(bytes58)
6766                                                    };
6767                                                    Some(e)
6768                                                }
6769                                                _ => _rt::invalid_enum_discriminant(),
6770                                            }
6771                                        };
6772                                        V67::HttpResponseTransferCoding(e67)
6773                                    }
6774                                    32 => {
6775                                        let e67 = {
6776                                            let l59 = i32::from(*ptr1.add(16).cast::<u8>());
6777                                            match l59 {
6778                                                0 => None,
6779                                                1 => {
6780                                                    let e = {
6781                                                        let l60 = *ptr1
6782                                                            .add(16 + 1 * ::core::mem::size_of::<*const u8>())
6783                                                            .cast::<*mut u8>();
6784                                                        let l61 = *ptr1
6785                                                            .add(16 + 2 * ::core::mem::size_of::<*const u8>())
6786                                                            .cast::<usize>();
6787                                                        let len62 = l61;
6788                                                        let bytes62 = _rt::Vec::from_raw_parts(
6789                                                            l60.cast(),
6790                                                            len62,
6791                                                            len62,
6792                                                        );
6793                                                        _rt::string_lift(bytes62)
6794                                                    };
6795                                                    Some(e)
6796                                                }
6797                                                _ => _rt::invalid_enum_discriminant(),
6798                                            }
6799                                        };
6800                                        V67::HttpResponseContentCoding(e67)
6801                                    }
6802                                    33 => V67::HttpResponseTimeout,
6803                                    34 => V67::HttpUpgradeFailed,
6804                                    35 => V67::HttpProtocolError,
6805                                    36 => V67::LoopDetected,
6806                                    37 => V67::ConfigurationError,
6807                                    n => {
6808                                        debug_assert_eq!(n, 38, "invalid enum discriminant");
6809                                        let e67 = {
6810                                            let l63 = i32::from(*ptr1.add(16).cast::<u8>());
6811                                            match l63 {
6812                                                0 => None,
6813                                                1 => {
6814                                                    let e = {
6815                                                        let l64 = *ptr1
6816                                                            .add(16 + 1 * ::core::mem::size_of::<*const u8>())
6817                                                            .cast::<*mut u8>();
6818                                                        let l65 = *ptr1
6819                                                            .add(16 + 2 * ::core::mem::size_of::<*const u8>())
6820                                                            .cast::<usize>();
6821                                                        let len66 = l65;
6822                                                        let bytes66 = _rt::Vec::from_raw_parts(
6823                                                            l64.cast(),
6824                                                            len66,
6825                                                            len66,
6826                                                        );
6827                                                        _rt::string_lift(bytes66)
6828                                                    };
6829                                                    Some(e)
6830                                                }
6831                                                _ => _rt::invalid_enum_discriminant(),
6832                                            }
6833                                        };
6834                                        V67::InternalError(e67)
6835                                    }
6836                                };
6837                                v67
6838                            };
6839                            Err(e)
6840                        }
6841                        _ => _rt::invalid_enum_discriminant(),
6842                    };
6843                    result68
6844                }
6845            }
6846        }
6847    }
6848}
6849#[rustfmt::skip]
6850#[allow(dead_code, clippy::all)]
6851pub mod exports {
6852    pub mod wasi {
6853        pub mod http {
6854            /// This interface defines a handler of incoming HTTP Requests. It should
6855            /// be exported by components which can respond to HTTP Requests.
6856            #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)]
6857            pub mod incoming_handler {
6858                #[used]
6859                #[doc(hidden)]
6860                static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports;
6861                use super::super::super::super::_rt;
6862                pub type IncomingRequest = super::super::super::super::wasi::http::types::IncomingRequest;
6863                pub type ResponseOutparam = super::super::super::super::wasi::http::types::ResponseOutparam;
6864                #[doc(hidden)]
6865                #[allow(non_snake_case, unused_unsafe)]
6866                pub unsafe fn _export_handle_cabi<T: Guest>(arg0: i32, arg1: i32) {
6867                    unsafe {
6868                        #[cfg(target_arch = "wasm32")] _rt::run_ctors_once();
6869                        {
6870                            T::handle(
6871                                super::super::super::super::wasi::http::types::IncomingRequest::from_handle(
6872                                    arg0 as u32,
6873                                ),
6874                                super::super::super::super::wasi::http::types::ResponseOutparam::from_handle(
6875                                    arg1 as u32,
6876                                ),
6877                            )
6878                        };
6879                    }
6880                }
6881                pub trait Guest {
6882                    /// This function is invoked with an incoming HTTP Request, and a resource
6883                    /// `response-outparam` which provides the capability to reply with an HTTP
6884                    /// Response. The response is sent by calling the `response-outparam.set`
6885                    /// method, which allows execution to continue after the response has been
6886                    /// sent. This enables both streaming to the response body, and performing other
6887                    /// work.
6888                    ///
6889                    /// The implementor of this function must write a response to the
6890                    /// `response-outparam` before returning, or else the caller will respond
6891                    /// with an error on its behalf.
6892                    #[allow(async_fn_in_trait)]
6893                    fn handle(
6894                        request: IncomingRequest,
6895                        response_out: ResponseOutparam,
6896                    ) -> ();
6897                }
6898                #[doc(hidden)]
6899                #[macro_export]
6900                macro_rules! __export_wasi_http_incoming_handler_0_2_4_cabi {
6901                    ($ty:ident with_types_in $($path_to_types:tt)*) => {
6902                        const _ : () = { #[unsafe (export_name =
6903                        "wasi:http/incoming-handler@0.2.4#handle")] unsafe extern "C" fn
6904                        export_handle(arg0 : i32, arg1 : i32,) { unsafe {
6905                        $($path_to_types)*:: _export_handle_cabi::<$ty > (arg0, arg1) } }
6906                        };
6907                    };
6908                }
6909                #[doc(hidden)]
6910                pub use __export_wasi_http_incoming_handler_0_2_4_cabi;
6911            }
6912        }
6913    }
6914}
6915#[rustfmt::skip]
6916mod _rt {
6917    #![allow(dead_code, clippy::all)]
6918    pub use alloc_crate::string::String;
6919    pub use alloc_crate::vec::Vec;
6920    use core::fmt;
6921    use core::marker;
6922    use core::sync::atomic::{AtomicU32, Ordering::Relaxed};
6923    /// A type which represents a component model resource, either imported or
6924    /// exported into this component.
6925    ///
6926    /// This is a low-level wrapper which handles the lifetime of the resource
6927    /// (namely this has a destructor). The `T` provided defines the component model
6928    /// intrinsics that this wrapper uses.
6929    ///
6930    /// One of the chief purposes of this type is to provide `Deref` implementations
6931    /// to access the underlying data when it is owned.
6932    ///
6933    /// This type is primarily used in generated code for exported and imported
6934    /// resources.
6935    #[repr(transparent)]
6936    pub struct Resource<T: WasmResource> {
6937        handle: AtomicU32,
6938        _marker: marker::PhantomData<T>,
6939    }
6940    /// A trait which all wasm resources implement, namely providing the ability to
6941    /// drop a resource.
6942    ///
6943    /// This generally is implemented by generated code, not user-facing code.
6944    #[allow(clippy::missing_safety_doc)]
6945    pub unsafe trait WasmResource {
6946        /// Invokes the `[resource-drop]...` intrinsic.
6947        unsafe fn drop(handle: u32);
6948    }
6949    impl<T: WasmResource> Resource<T> {
6950        #[doc(hidden)]
6951        pub unsafe fn from_handle(handle: u32) -> Self {
6952            debug_assert!(handle != 0 && handle != u32::MAX);
6953            Self {
6954                handle: AtomicU32::new(handle),
6955                _marker: marker::PhantomData,
6956            }
6957        }
6958        /// Takes ownership of the handle owned by `resource`.
6959        ///
6960        /// Note that this ideally would be `into_handle` taking `Resource<T>` by
6961        /// ownership. The code generator does not enable that in all situations,
6962        /// unfortunately, so this is provided instead.
6963        ///
6964        /// Also note that `take_handle` is in theory only ever called on values
6965        /// owned by a generated function. For example a generated function might
6966        /// take `Resource<T>` as an argument but then call `take_handle` on a
6967        /// reference to that argument. In that sense the dynamic nature of
6968        /// `take_handle` should only be exposed internally to generated code, not
6969        /// to user code.
6970        #[doc(hidden)]
6971        pub fn take_handle(resource: &Resource<T>) -> u32 {
6972            resource.handle.swap(u32::MAX, Relaxed)
6973        }
6974        #[doc(hidden)]
6975        pub fn handle(resource: &Resource<T>) -> u32 {
6976            resource.handle.load(Relaxed)
6977        }
6978    }
6979    impl<T: WasmResource> fmt::Debug for Resource<T> {
6980        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
6981            f.debug_struct("Resource").field("handle", &self.handle).finish()
6982        }
6983    }
6984    impl<T: WasmResource> Drop for Resource<T> {
6985        fn drop(&mut self) {
6986            unsafe {
6987                match self.handle.load(Relaxed) {
6988                    u32::MAX => {}
6989                    other => T::drop(other),
6990                }
6991            }
6992        }
6993    }
6994    pub unsafe fn string_lift(bytes: Vec<u8>) -> String {
6995        if cfg!(debug_assertions) {
6996            String::from_utf8(bytes).unwrap()
6997        } else {
6998            unsafe { String::from_utf8_unchecked(bytes) }
6999        }
7000    }
7001    pub unsafe fn invalid_enum_discriminant<T>() -> T {
7002        if cfg!(debug_assertions) {
7003            panic!("invalid enum discriminant")
7004        } else {
7005            unsafe { core::hint::unreachable_unchecked() }
7006        }
7007    }
7008    pub use alloc_crate::alloc;
7009    pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) {
7010        if size == 0 {
7011            return;
7012        }
7013        unsafe {
7014            let layout = alloc::Layout::from_size_align_unchecked(size, align);
7015            alloc::dealloc(ptr, layout);
7016        }
7017    }
7018    pub unsafe fn bool_lift(val: u8) -> bool {
7019        if cfg!(debug_assertions) {
7020            match val {
7021                0 => false,
7022                1 => true,
7023                _ => panic!("invalid bool discriminant"),
7024            }
7025        } else {
7026            val != 0
7027        }
7028    }
7029    pub fn as_i64<T: AsI64>(t: T) -> i64 {
7030        t.as_i64()
7031    }
7032    pub trait AsI64 {
7033        fn as_i64(self) -> i64;
7034    }
7035    impl<'a, T: Copy + AsI64> AsI64 for &'a T {
7036        fn as_i64(self) -> i64 {
7037            (*self).as_i64()
7038        }
7039    }
7040    impl AsI64 for i64 {
7041        #[inline]
7042        fn as_i64(self) -> i64 {
7043            self as i64
7044        }
7045    }
7046    impl AsI64 for u64 {
7047        #[inline]
7048        fn as_i64(self) -> i64 {
7049            self as i64
7050        }
7051    }
7052    pub fn as_i32<T: AsI32>(t: T) -> i32 {
7053        t.as_i32()
7054    }
7055    pub trait AsI32 {
7056        fn as_i32(self) -> i32;
7057    }
7058    impl<'a, T: Copy + AsI32> AsI32 for &'a T {
7059        fn as_i32(self) -> i32 {
7060            (*self).as_i32()
7061        }
7062    }
7063    impl AsI32 for i32 {
7064        #[inline]
7065        fn as_i32(self) -> i32 {
7066            self as i32
7067        }
7068    }
7069    impl AsI32 for u32 {
7070        #[inline]
7071        fn as_i32(self) -> i32 {
7072            self as i32
7073        }
7074    }
7075    impl AsI32 for i16 {
7076        #[inline]
7077        fn as_i32(self) -> i32 {
7078            self as i32
7079        }
7080    }
7081    impl AsI32 for u16 {
7082        #[inline]
7083        fn as_i32(self) -> i32 {
7084            self as i32
7085        }
7086    }
7087    impl AsI32 for i8 {
7088        #[inline]
7089        fn as_i32(self) -> i32 {
7090            self as i32
7091        }
7092    }
7093    impl AsI32 for u8 {
7094        #[inline]
7095        fn as_i32(self) -> i32 {
7096            self as i32
7097        }
7098    }
7099    impl AsI32 for char {
7100        #[inline]
7101        fn as_i32(self) -> i32 {
7102            self as i32
7103        }
7104    }
7105    impl AsI32 for usize {
7106        #[inline]
7107        fn as_i32(self) -> i32 {
7108            self as i32
7109        }
7110    }
7111    #[cfg(target_arch = "wasm32")]
7112    pub fn run_ctors_once() {
7113        wit_bindgen::rt::run_ctors_once();
7114    }
7115    extern crate alloc as alloc_crate;
7116}
7117/// Generates `#[unsafe(no_mangle)]` functions to export the specified type as
7118/// the root implementation of all generated traits.
7119///
7120/// For more information see the documentation of `wit_bindgen::generate!`.
7121///
7122/// ```rust
7123/// # macro_rules! _export_proxy{ ($($t:tt)*) => (); }
7124/// # trait Guest {}
7125/// struct MyType;
7126///
7127/// impl Guest for MyType {
7128///     // ...
7129/// }
7130///
7131/// _export_proxy!(MyType);
7132/// ```
7133#[allow(unused_macros)]
7134#[doc(hidden)]
7135#[macro_export]
7136macro_rules! __export_proxy_impl {
7137    ($ty:ident) => {
7138        $crate::_export_proxy!($ty with_types_in $crate);
7139    };
7140    ($ty:ident with_types_in $($path_to_types_root:tt)*) => {
7141        $($path_to_types_root)*::
7142        exports::wasi::http::incoming_handler::__export_wasi_http_incoming_handler_0_2_4_cabi!($ty
7143        with_types_in $($path_to_types_root)*:: exports::wasi::http::incoming_handler);
7144        const _ : () = { #[rustfmt::skip] #[cfg(target_arch = "wasm32")] #[unsafe
7145        (link_section =
7146        "component-type:wit-bindgen:0.46.0:wasi:http@0.2.4:proxy:imports and exportsrust-wasip2-1.0.1+wasi-0.2.4-from-crates-io-proxy-world")]
7147        #[doc(hidden)] #[allow(clippy::octal_escapes)] pub static
7148        __WIT_BINDGEN_COMPONENT_TYPE : [u8; 7040] = *
7149        b"\
7150\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\x846\x01A\x02\x01A#\x01\
7151B\x0a\x04\0\x08pollable\x03\x01\x01h\0\x01@\x01\x04self\x01\0\x7f\x04\0\x16[meth\
7152od]pollable.ready\x01\x02\x01@\x01\x04self\x01\x01\0\x04\0\x16[method]pollable.b\
7153lock\x01\x03\x01p\x01\x01py\x01@\x01\x02in\x04\0\x05\x04\0\x04poll\x01\x06\x03\0\
7154\x12wasi:io/poll@0.2.4\x05\0\x02\x03\0\0\x08pollable\x01B\x0f\x02\x03\x02\x01\x01\
7155\x04\0\x08pollable\x03\0\0\x01w\x04\0\x07instant\x03\0\x02\x01w\x04\0\x08duratio\
7156n\x03\0\x04\x01@\0\0\x03\x04\0\x03now\x01\x06\x01@\0\0\x05\x04\0\x0aresolution\x01\
7157\x07\x01i\x01\x01@\x01\x04when\x03\0\x08\x04\0\x11subscribe-instant\x01\x09\x01@\
7158\x01\x04when\x05\0\x08\x04\0\x12subscribe-duration\x01\x0a\x03\0!wasi:clocks/mon\
7159otonic-clock@0.2.4\x05\x02\x01B\x05\x01r\x02\x07secondsw\x0bnanosecondsy\x04\0\x08\
7160datetime\x03\0\0\x01@\0\0\x01\x04\0\x03now\x01\x02\x04\0\x0aresolution\x01\x02\x03\
7161\0\x1cwasi:clocks/wall-clock@0.2.4\x05\x03\x01B\x05\x01p}\x01@\x01\x03lenw\0\0\x04\
7162\0\x10get-random-bytes\x01\x01\x01@\0\0w\x04\0\x0eget-random-u64\x01\x02\x03\0\x18\
7163wasi:random/random@0.2.4\x05\x04\x01B\x04\x04\0\x05error\x03\x01\x01h\0\x01@\x01\
7164\x04self\x01\0s\x04\0\x1d[method]error.to-debug-string\x01\x02\x03\0\x13wasi:io/\
7165error@0.2.4\x05\x05\x02\x03\0\x04\x05error\x01B(\x02\x03\x02\x01\x06\x04\0\x05er\
7166ror\x03\0\0\x02\x03\x02\x01\x01\x04\0\x08pollable\x03\0\x02\x01i\x01\x01q\x02\x15\
7167last-operation-failed\x01\x04\0\x06closed\0\0\x04\0\x0cstream-error\x03\0\x05\x04\
7168\0\x0cinput-stream\x03\x01\x04\0\x0doutput-stream\x03\x01\x01h\x07\x01p}\x01j\x01\
7169\x0a\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0b\x04\0\x19[method]input-stream.re\
7170ad\x01\x0c\x04\0\"[method]input-stream.blocking-read\x01\x0c\x01j\x01w\x01\x06\x01\
7171@\x02\x04self\x09\x03lenw\0\x0d\x04\0\x19[method]input-stream.skip\x01\x0e\x04\0\
7172\"[method]input-stream.blocking-skip\x01\x0e\x01i\x03\x01@\x01\x04self\x09\0\x0f\
7173\x04\0\x1e[method]input-stream.subscribe\x01\x10\x01h\x08\x01@\x01\x04self\x11\0\
7174\x0d\x04\0![method]output-stream.check-write\x01\x12\x01j\0\x01\x06\x01@\x02\x04\
7175self\x11\x08contents\x0a\0\x13\x04\0\x1b[method]output-stream.write\x01\x14\x04\0\
7176.[method]output-stream.blocking-write-and-flush\x01\x14\x01@\x01\x04self\x11\0\x13\
7177\x04\0\x1b[method]output-stream.flush\x01\x15\x04\0$[method]output-stream.blocki\
7178ng-flush\x01\x15\x01@\x01\x04self\x11\0\x0f\x04\0\x1f[method]output-stream.subsc\
7179ribe\x01\x16\x01@\x02\x04self\x11\x03lenw\0\x13\x04\0\"[method]output-stream.wri\
7180te-zeroes\x01\x17\x04\05[method]output-stream.blocking-write-zeroes-and-flush\x01\
7181\x17\x01@\x03\x04self\x11\x03src\x09\x03lenw\0\x0d\x04\0\x1c[method]output-strea\
7182m.splice\x01\x18\x04\0%[method]output-stream.blocking-splice\x01\x18\x03\0\x15wa\
7183si:io/streams@0.2.4\x05\x07\x02\x03\0\x05\x0doutput-stream\x01B\x05\x02\x03\x02\x01\
7184\x08\x04\0\x0doutput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x0aget-stdout\x01\
7185\x03\x03\0\x15wasi:cli/stdout@0.2.4\x05\x09\x01B\x05\x02\x03\x02\x01\x08\x04\0\x0d\
7186output-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x0aget-stderr\x01\x03\x03\0\x15\
7187wasi:cli/stderr@0.2.4\x05\x0a\x02\x03\0\x05\x0cinput-stream\x01B\x05\x02\x03\x02\
7188\x01\x0b\x04\0\x0cinput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x09get-stdin\x01\
7189\x03\x03\0\x14wasi:cli/stdin@0.2.4\x05\x0c\x02\x03\0\x01\x08duration\x01B\xc1\x01\
7190\x02\x03\x02\x01\x0d\x04\0\x08duration\x03\0\0\x02\x03\x02\x01\x0b\x04\0\x0cinpu\
7191t-stream\x03\0\x02\x02\x03\x02\x01\x08\x04\0\x0doutput-stream\x03\0\x04\x02\x03\x02\
7192\x01\x06\x04\0\x08io-error\x03\0\x06\x02\x03\x02\x01\x01\x04\0\x08pollable\x03\0\
7193\x08\x01q\x0a\x03get\0\0\x04head\0\0\x04post\0\0\x03put\0\0\x06delete\0\0\x07con\
7194nect\0\0\x07options\0\0\x05trace\0\0\x05patch\0\0\x05other\x01s\0\x04\0\x06metho\
7195d\x03\0\x0a\x01q\x03\x04HTTP\0\0\x05HTTPS\0\0\x05other\x01s\0\x04\0\x06scheme\x03\
7196\0\x0c\x01ks\x01k{\x01r\x02\x05rcode\x0e\x09info-code\x0f\x04\0\x11DNS-error-pay\
7197load\x03\0\x10\x01k}\x01r\x02\x08alert-id\x12\x0dalert-message\x0e\x04\0\x1aTLS-\
7198alert-received-payload\x03\0\x13\x01ky\x01r\x02\x0afield-name\x0e\x0afield-size\x15\
7199\x04\0\x12field-size-payload\x03\0\x16\x01kw\x01k\x17\x01q'\x0bDNS-timeout\0\0\x09\
7200DNS-error\x01\x11\0\x15destination-not-found\0\0\x17destination-unavailable\0\0\x19\
7201destination-IP-prohibited\0\0\x19destination-IP-unroutable\0\0\x12connection-ref\
7202used\0\0\x15connection-terminated\0\0\x12connection-timeout\0\0\x17connection-re\
7203ad-timeout\0\0\x18connection-write-timeout\0\0\x18connection-limit-reached\0\0\x12\
7204TLS-protocol-error\0\0\x15TLS-certificate-error\0\0\x12TLS-alert-received\x01\x14\
7205\0\x13HTTP-request-denied\0\0\x1cHTTP-request-length-required\0\0\x16HTTP-reques\
7206t-body-size\x01\x18\0\x1bHTTP-request-method-invalid\0\0\x18HTTP-request-URI-inv\
7207alid\0\0\x19HTTP-request-URI-too-long\0\0\x20HTTP-request-header-section-size\x01\
7208\x15\0\x18HTTP-request-header-size\x01\x19\0!HTTP-request-trailer-section-size\x01\
7209\x15\0\x19HTTP-request-trailer-size\x01\x17\0\x18HTTP-response-incomplete\0\0!HT\
7210TP-response-header-section-size\x01\x15\0\x19HTTP-response-header-size\x01\x17\0\
7211\x17HTTP-response-body-size\x01\x18\0\"HTTP-response-trailer-section-size\x01\x15\
7212\0\x1aHTTP-response-trailer-size\x01\x17\0\x1dHTTP-response-transfer-coding\x01\x0e\
7213\0\x1cHTTP-response-content-coding\x01\x0e\0\x15HTTP-response-timeout\0\0\x13HTT\
7214P-upgrade-failed\0\0\x13HTTP-protocol-error\0\0\x0dloop-detected\0\0\x13configur\
7215ation-error\0\0\x0einternal-error\x01\x0e\0\x04\0\x0aerror-code\x03\0\x1a\x01q\x03\
7216\x0einvalid-syntax\0\0\x09forbidden\0\0\x09immutable\0\0\x04\0\x0cheader-error\x03\
7217\0\x1c\x01s\x04\0\x09field-key\x03\0\x1e\x04\0\x0afield-name\x03\0\x1f\x01p}\x04\
7218\0\x0bfield-value\x03\0!\x04\0\x06fields\x03\x01\x04\0\x07headers\x03\0#\x04\0\x08\
7219trailers\x03\0#\x04\0\x10incoming-request\x03\x01\x04\0\x10outgoing-request\x03\x01\
7220\x04\0\x0frequest-options\x03\x01\x04\0\x11response-outparam\x03\x01\x01{\x04\0\x0b\
7221status-code\x03\0*\x04\0\x11incoming-response\x03\x01\x04\0\x0dincoming-body\x03\
7222\x01\x04\0\x0ffuture-trailers\x03\x01\x04\0\x11outgoing-response\x03\x01\x04\0\x0d\
7223outgoing-body\x03\x01\x04\0\x18future-incoming-response\x03\x01\x01i#\x01@\0\02\x04\
7224\0\x13[constructor]fields\x013\x01o\x02\x20\"\x01p4\x01j\x012\x01\x1d\x01@\x01\x07\
7225entries5\06\x04\0\x18[static]fields.from-list\x017\x01h#\x01p\"\x01@\x02\x04self\
72268\x04name\x20\09\x04\0\x12[method]fields.get\x01:\x01@\x02\x04self8\x04name\x20\0\
7227\x7f\x04\0\x12[method]fields.has\x01;\x01j\0\x01\x1d\x01@\x03\x04self8\x04name\x20\
7228\x05value9\0<\x04\0\x12[method]fields.set\x01=\x01@\x02\x04self8\x04name\x20\0<\x04\
7229\0\x15[method]fields.delete\x01>\x01@\x03\x04self8\x04name\x20\x05value\"\0<\x04\
7230\0\x15[method]fields.append\x01?\x01@\x01\x04self8\05\x04\0\x16[method]fields.en\
7231tries\x01@\x01@\x01\x04self8\02\x04\0\x14[method]fields.clone\x01A\x01h&\x01@\x01\
7232\x04self\xc2\0\0\x0b\x04\0\x1f[method]incoming-request.method\x01C\x01@\x01\x04s\
7233elf\xc2\0\0\x0e\x04\0([method]incoming-request.path-with-query\x01D\x01k\x0d\x01\
7234@\x01\x04self\xc2\0\0\xc5\0\x04\0\x1f[method]incoming-request.scheme\x01F\x04\0\"\
7235[method]incoming-request.authority\x01D\x01i$\x01@\x01\x04self\xc2\0\0\xc7\0\x04\
7236\0\x20[method]incoming-request.headers\x01H\x01i-\x01j\x01\xc9\0\0\x01@\x01\x04s\
7237elf\xc2\0\0\xca\0\x04\0\x20[method]incoming-request.consume\x01K\x01i'\x01@\x01\x07\
7238headers\xc7\0\0\xcc\0\x04\0\x1d[constructor]outgoing-request\x01M\x01h'\x01i0\x01\
7239j\x01\xcf\0\0\x01@\x01\x04self\xce\0\0\xd0\0\x04\0\x1d[method]outgoing-request.b\
7240ody\x01Q\x01@\x01\x04self\xce\0\0\x0b\x04\0\x1f[method]outgoing-request.method\x01\
7241R\x01j\0\0\x01@\x02\x04self\xce\0\x06method\x0b\0\xd3\0\x04\0#[method]outgoing-r\
7242equest.set-method\x01T\x01@\x01\x04self\xce\0\0\x0e\x04\0([method]outgoing-reque\
7243st.path-with-query\x01U\x01@\x02\x04self\xce\0\x0fpath-with-query\x0e\0\xd3\0\x04\
7244\0,[method]outgoing-request.set-path-with-query\x01V\x01@\x01\x04self\xce\0\0\xc5\
7245\0\x04\0\x1f[method]outgoing-request.scheme\x01W\x01@\x02\x04self\xce\0\x06schem\
7246e\xc5\0\0\xd3\0\x04\0#[method]outgoing-request.set-scheme\x01X\x04\0\"[method]ou\
7247tgoing-request.authority\x01U\x01@\x02\x04self\xce\0\x09authority\x0e\0\xd3\0\x04\
7248\0&[method]outgoing-request.set-authority\x01Y\x01@\x01\x04self\xce\0\0\xc7\0\x04\
7249\0\x20[method]outgoing-request.headers\x01Z\x01i(\x01@\0\0\xdb\0\x04\0\x1c[const\
7250ructor]request-options\x01\\\x01h(\x01k\x01\x01@\x01\x04self\xdd\0\0\xde\0\x04\0\
7251'[method]request-options.connect-timeout\x01_\x01@\x02\x04self\xdd\0\x08duration\
7252\xde\0\0\xd3\0\x04\0+[method]request-options.set-connect-timeout\x01`\x04\0*[met\
7253hod]request-options.first-byte-timeout\x01_\x04\0.[method]request-options.set-fi\
7254rst-byte-timeout\x01`\x04\0-[method]request-options.between-bytes-timeout\x01_\x04\
7255\01[method]request-options.set-between-bytes-timeout\x01`\x01i)\x01i/\x01j\x01\xe2\
7256\0\x01\x1b\x01@\x02\x05param\xe1\0\x08response\xe3\0\x01\0\x04\0\x1d[static]resp\
7257onse-outparam.set\x01d\x01h,\x01@\x01\x04self\xe5\0\0+\x04\0\x20[method]incoming\
7258-response.status\x01f\x01@\x01\x04self\xe5\0\0\xc7\0\x04\0![method]incoming-resp\
7259onse.headers\x01g\x01@\x01\x04self\xe5\0\0\xca\0\x04\0![method]incoming-response\
7260.consume\x01h\x01h-\x01i\x03\x01j\x01\xea\0\0\x01@\x01\x04self\xe9\0\0\xeb\0\x04\
7261\0\x1c[method]incoming-body.stream\x01l\x01i.\x01@\x01\x04this\xc9\0\0\xed\0\x04\
7262\0\x1c[static]incoming-body.finish\x01n\x01h.\x01i\x09\x01@\x01\x04self\xef\0\0\xf0\
7263\0\x04\0![method]future-trailers.subscribe\x01q\x01i%\x01k\xf2\0\x01j\x01\xf3\0\x01\
7264\x1b\x01j\x01\xf4\0\0\x01k\xf5\0\x01@\x01\x04self\xef\0\0\xf6\0\x04\0\x1b[method\
7265]future-trailers.get\x01w\x01@\x01\x07headers\xc7\0\0\xe2\0\x04\0\x1e[constructo\
7266r]outgoing-response\x01x\x01h/\x01@\x01\x04self\xf9\0\0+\x04\0%[method]outgoing-\
7267response.status-code\x01z\x01@\x02\x04self\xf9\0\x0bstatus-code+\0\xd3\0\x04\0)[\
7268method]outgoing-response.set-status-code\x01{\x01@\x01\x04self\xf9\0\0\xc7\0\x04\
7269\0![method]outgoing-response.headers\x01|\x01@\x01\x04self\xf9\0\0\xd0\0\x04\0\x1e\
7270[method]outgoing-response.body\x01}\x01h0\x01i\x05\x01j\x01\xff\0\0\x01@\x01\x04\
7271self\xfe\0\0\x80\x01\x04\0\x1b[method]outgoing-body.write\x01\x81\x01\x01j\0\x01\
7272\x1b\x01@\x02\x04this\xcf\0\x08trailers\xf3\0\0\x82\x01\x04\0\x1c[static]outgoin\
7273g-body.finish\x01\x83\x01\x01h1\x01@\x01\x04self\x84\x01\0\xf0\0\x04\0*[method]f\
7274uture-incoming-response.subscribe\x01\x85\x01\x01i,\x01j\x01\x86\x01\x01\x1b\x01\
7275j\x01\x87\x01\0\x01k\x88\x01\x01@\x01\x04self\x84\x01\0\x89\x01\x04\0$[method]fu\
7276ture-incoming-response.get\x01\x8a\x01\x01h\x07\x01k\x1b\x01@\x01\x03err\x8b\x01\
7277\0\x8c\x01\x04\0\x0fhttp-error-code\x01\x8d\x01\x03\0\x15wasi:http/types@0.2.4\x05\
7278\x0e\x02\x03\0\x09\x10outgoing-request\x02\x03\0\x09\x0frequest-options\x02\x03\0\
7279\x09\x18future-incoming-response\x02\x03\0\x09\x0aerror-code\x01B\x0f\x02\x03\x02\
7280\x01\x0f\x04\0\x10outgoing-request\x03\0\0\x02\x03\x02\x01\x10\x04\0\x0frequest-\
7281options\x03\0\x02\x02\x03\x02\x01\x11\x04\0\x18future-incoming-response\x03\0\x04\
7282\x02\x03\x02\x01\x12\x04\0\x0aerror-code\x03\0\x06\x01i\x01\x01i\x03\x01k\x09\x01\
7283i\x05\x01j\x01\x0b\x01\x07\x01@\x02\x07request\x08\x07options\x0a\0\x0c\x04\0\x06\
7284handle\x01\x0d\x03\0\x20wasi:http/outgoing-handler@0.2.4\x05\x13\x02\x03\0\x09\x10\
7285incoming-request\x02\x03\0\x09\x11response-outparam\x01B\x08\x02\x03\x02\x01\x14\
7286\x04\0\x10incoming-request\x03\0\0\x02\x03\x02\x01\x15\x04\0\x11response-outpara\
7287m\x03\0\x02\x01i\x01\x01i\x03\x01@\x02\x07request\x04\x0cresponse-out\x05\x01\0\x04\
7288\0\x06handle\x01\x06\x04\0\x20wasi:http/incoming-handler@0.2.4\x05\x16\x04\0\x15\
7289wasi:http/proxy@0.2.4\x04\0\x0b\x0b\x01\0\x05proxy\x03\0\0\0G\x09producers\x01\x0c\
7290processed-by\x02\x0dwit-component\x070.239.0\x10wit-bindgen-rust\x060.46.0";
7291        };
7292    };
7293}
7294#[doc(inline)]
7295pub use __export_proxy_impl as _export_proxy;
7296#[rustfmt::skip]
7297#[cfg(target_arch = "wasm32")]
7298
7299#[cfg_attr(feature = "rustc-dep-of-std", unsafe(link_section = "component-type:wit-bindgen:0.46.0:wasi:http@0.2.4:proxy-with-all-of-its-exports-removed:encoded worldrust-wasip2-1.0.1+wasi-0.2.4-from-crates-io-proxy-world-in-libstd"))]
7300#[cfg_attr(not(feature = "rustc-dep-of-std"), unsafe(link_section = "component-type:wit-bindgen:0.46.0:wasi:http@0.2.4:proxy-with-all-of-its-exports-removed:encoded worldrust-wasip2-1.0.1+wasi-0.2.4-from-crates-io-proxy-world"))]
7301
7302#[doc(hidden)]
7303#[allow(clippy::octal_escapes)]
7304pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 6921] = *b"\
7305\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xed4\x01A\x02\x01A\x1f\
7306\x01B\x0a\x04\0\x08pollable\x03\x01\x01h\0\x01@\x01\x04self\x01\0\x7f\x04\0\x16[\
7307method]pollable.ready\x01\x02\x01@\x01\x04self\x01\x01\0\x04\0\x16[method]pollab\
7308le.block\x01\x03\x01p\x01\x01py\x01@\x01\x02in\x04\0\x05\x04\0\x04poll\x01\x06\x03\
7309\0\x12wasi:io/poll@0.2.4\x05\0\x02\x03\0\0\x08pollable\x01B\x0f\x02\x03\x02\x01\x01\
7310\x04\0\x08pollable\x03\0\0\x01w\x04\0\x07instant\x03\0\x02\x01w\x04\0\x08duratio\
7311n\x03\0\x04\x01@\0\0\x03\x04\0\x03now\x01\x06\x01@\0\0\x05\x04\0\x0aresolution\x01\
7312\x07\x01i\x01\x01@\x01\x04when\x03\0\x08\x04\0\x11subscribe-instant\x01\x09\x01@\
7313\x01\x04when\x05\0\x08\x04\0\x12subscribe-duration\x01\x0a\x03\0!wasi:clocks/mon\
7314otonic-clock@0.2.4\x05\x02\x01B\x05\x01r\x02\x07secondsw\x0bnanosecondsy\x04\0\x08\
7315datetime\x03\0\0\x01@\0\0\x01\x04\0\x03now\x01\x02\x04\0\x0aresolution\x01\x02\x03\
7316\0\x1cwasi:clocks/wall-clock@0.2.4\x05\x03\x01B\x05\x01p}\x01@\x01\x03lenw\0\0\x04\
7317\0\x10get-random-bytes\x01\x01\x01@\0\0w\x04\0\x0eget-random-u64\x01\x02\x03\0\x18\
7318wasi:random/random@0.2.4\x05\x04\x01B\x04\x04\0\x05error\x03\x01\x01h\0\x01@\x01\
7319\x04self\x01\0s\x04\0\x1d[method]error.to-debug-string\x01\x02\x03\0\x13wasi:io/\
7320error@0.2.4\x05\x05\x02\x03\0\x04\x05error\x01B(\x02\x03\x02\x01\x06\x04\0\x05er\
7321ror\x03\0\0\x02\x03\x02\x01\x01\x04\0\x08pollable\x03\0\x02\x01i\x01\x01q\x02\x15\
7322last-operation-failed\x01\x04\0\x06closed\0\0\x04\0\x0cstream-error\x03\0\x05\x04\
7323\0\x0cinput-stream\x03\x01\x04\0\x0doutput-stream\x03\x01\x01h\x07\x01p}\x01j\x01\
7324\x0a\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0b\x04\0\x19[method]input-stream.re\
7325ad\x01\x0c\x04\0\"[method]input-stream.blocking-read\x01\x0c\x01j\x01w\x01\x06\x01\
7326@\x02\x04self\x09\x03lenw\0\x0d\x04\0\x19[method]input-stream.skip\x01\x0e\x04\0\
7327\"[method]input-stream.blocking-skip\x01\x0e\x01i\x03\x01@\x01\x04self\x09\0\x0f\
7328\x04\0\x1e[method]input-stream.subscribe\x01\x10\x01h\x08\x01@\x01\x04self\x11\0\
7329\x0d\x04\0![method]output-stream.check-write\x01\x12\x01j\0\x01\x06\x01@\x02\x04\
7330self\x11\x08contents\x0a\0\x13\x04\0\x1b[method]output-stream.write\x01\x14\x04\0\
7331.[method]output-stream.blocking-write-and-flush\x01\x14\x01@\x01\x04self\x11\0\x13\
7332\x04\0\x1b[method]output-stream.flush\x01\x15\x04\0$[method]output-stream.blocki\
7333ng-flush\x01\x15\x01@\x01\x04self\x11\0\x0f\x04\0\x1f[method]output-stream.subsc\
7334ribe\x01\x16\x01@\x02\x04self\x11\x03lenw\0\x13\x04\0\"[method]output-stream.wri\
7335te-zeroes\x01\x17\x04\05[method]output-stream.blocking-write-zeroes-and-flush\x01\
7336\x17\x01@\x03\x04self\x11\x03src\x09\x03lenw\0\x0d\x04\0\x1c[method]output-strea\
7337m.splice\x01\x18\x04\0%[method]output-stream.blocking-splice\x01\x18\x03\0\x15wa\
7338si:io/streams@0.2.4\x05\x07\x02\x03\0\x05\x0doutput-stream\x01B\x05\x02\x03\x02\x01\
7339\x08\x04\0\x0doutput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x0aget-stdout\x01\
7340\x03\x03\0\x15wasi:cli/stdout@0.2.4\x05\x09\x01B\x05\x02\x03\x02\x01\x08\x04\0\x0d\
7341output-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x0aget-stderr\x01\x03\x03\0\x15\
7342wasi:cli/stderr@0.2.4\x05\x0a\x02\x03\0\x05\x0cinput-stream\x01B\x05\x02\x03\x02\
7343\x01\x0b\x04\0\x0cinput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x09get-stdin\x01\
7344\x03\x03\0\x14wasi:cli/stdin@0.2.4\x05\x0c\x02\x03\0\x01\x08duration\x01B\xc1\x01\
7345\x02\x03\x02\x01\x0d\x04\0\x08duration\x03\0\0\x02\x03\x02\x01\x0b\x04\0\x0cinpu\
7346t-stream\x03\0\x02\x02\x03\x02\x01\x08\x04\0\x0doutput-stream\x03\0\x04\x02\x03\x02\
7347\x01\x06\x04\0\x08io-error\x03\0\x06\x02\x03\x02\x01\x01\x04\0\x08pollable\x03\0\
7348\x08\x01q\x0a\x03get\0\0\x04head\0\0\x04post\0\0\x03put\0\0\x06delete\0\0\x07con\
7349nect\0\0\x07options\0\0\x05trace\0\0\x05patch\0\0\x05other\x01s\0\x04\0\x06metho\
7350d\x03\0\x0a\x01q\x03\x04HTTP\0\0\x05HTTPS\0\0\x05other\x01s\0\x04\0\x06scheme\x03\
7351\0\x0c\x01ks\x01k{\x01r\x02\x05rcode\x0e\x09info-code\x0f\x04\0\x11DNS-error-pay\
7352load\x03\0\x10\x01k}\x01r\x02\x08alert-id\x12\x0dalert-message\x0e\x04\0\x1aTLS-\
7353alert-received-payload\x03\0\x13\x01ky\x01r\x02\x0afield-name\x0e\x0afield-size\x15\
7354\x04\0\x12field-size-payload\x03\0\x16\x01kw\x01k\x17\x01q'\x0bDNS-timeout\0\0\x09\
7355DNS-error\x01\x11\0\x15destination-not-found\0\0\x17destination-unavailable\0\0\x19\
7356destination-IP-prohibited\0\0\x19destination-IP-unroutable\0\0\x12connection-ref\
7357used\0\0\x15connection-terminated\0\0\x12connection-timeout\0\0\x17connection-re\
7358ad-timeout\0\0\x18connection-write-timeout\0\0\x18connection-limit-reached\0\0\x12\
7359TLS-protocol-error\0\0\x15TLS-certificate-error\0\0\x12TLS-alert-received\x01\x14\
7360\0\x13HTTP-request-denied\0\0\x1cHTTP-request-length-required\0\0\x16HTTP-reques\
7361t-body-size\x01\x18\0\x1bHTTP-request-method-invalid\0\0\x18HTTP-request-URI-inv\
7362alid\0\0\x19HTTP-request-URI-too-long\0\0\x20HTTP-request-header-section-size\x01\
7363\x15\0\x18HTTP-request-header-size\x01\x19\0!HTTP-request-trailer-section-size\x01\
7364\x15\0\x19HTTP-request-trailer-size\x01\x17\0\x18HTTP-response-incomplete\0\0!HT\
7365TP-response-header-section-size\x01\x15\0\x19HTTP-response-header-size\x01\x17\0\
7366\x17HTTP-response-body-size\x01\x18\0\"HTTP-response-trailer-section-size\x01\x15\
7367\0\x1aHTTP-response-trailer-size\x01\x17\0\x1dHTTP-response-transfer-coding\x01\x0e\
7368\0\x1cHTTP-response-content-coding\x01\x0e\0\x15HTTP-response-timeout\0\0\x13HTT\
7369P-upgrade-failed\0\0\x13HTTP-protocol-error\0\0\x0dloop-detected\0\0\x13configur\
7370ation-error\0\0\x0einternal-error\x01\x0e\0\x04\0\x0aerror-code\x03\0\x1a\x01q\x03\
7371\x0einvalid-syntax\0\0\x09forbidden\0\0\x09immutable\0\0\x04\0\x0cheader-error\x03\
7372\0\x1c\x01s\x04\0\x09field-key\x03\0\x1e\x04\0\x0afield-name\x03\0\x1f\x01p}\x04\
7373\0\x0bfield-value\x03\0!\x04\0\x06fields\x03\x01\x04\0\x07headers\x03\0#\x04\0\x08\
7374trailers\x03\0#\x04\0\x10incoming-request\x03\x01\x04\0\x10outgoing-request\x03\x01\
7375\x04\0\x0frequest-options\x03\x01\x04\0\x11response-outparam\x03\x01\x01{\x04\0\x0b\
7376status-code\x03\0*\x04\0\x11incoming-response\x03\x01\x04\0\x0dincoming-body\x03\
7377\x01\x04\0\x0ffuture-trailers\x03\x01\x04\0\x11outgoing-response\x03\x01\x04\0\x0d\
7378outgoing-body\x03\x01\x04\0\x18future-incoming-response\x03\x01\x01i#\x01@\0\02\x04\
7379\0\x13[constructor]fields\x013\x01o\x02\x20\"\x01p4\x01j\x012\x01\x1d\x01@\x01\x07\
7380entries5\06\x04\0\x18[static]fields.from-list\x017\x01h#\x01p\"\x01@\x02\x04self\
73818\x04name\x20\09\x04\0\x12[method]fields.get\x01:\x01@\x02\x04self8\x04name\x20\0\
7382\x7f\x04\0\x12[method]fields.has\x01;\x01j\0\x01\x1d\x01@\x03\x04self8\x04name\x20\
7383\x05value9\0<\x04\0\x12[method]fields.set\x01=\x01@\x02\x04self8\x04name\x20\0<\x04\
7384\0\x15[method]fields.delete\x01>\x01@\x03\x04self8\x04name\x20\x05value\"\0<\x04\
7385\0\x15[method]fields.append\x01?\x01@\x01\x04self8\05\x04\0\x16[method]fields.en\
7386tries\x01@\x01@\x01\x04self8\02\x04\0\x14[method]fields.clone\x01A\x01h&\x01@\x01\
7387\x04self\xc2\0\0\x0b\x04\0\x1f[method]incoming-request.method\x01C\x01@\x01\x04s\
7388elf\xc2\0\0\x0e\x04\0([method]incoming-request.path-with-query\x01D\x01k\x0d\x01\
7389@\x01\x04self\xc2\0\0\xc5\0\x04\0\x1f[method]incoming-request.scheme\x01F\x04\0\"\
7390[method]incoming-request.authority\x01D\x01i$\x01@\x01\x04self\xc2\0\0\xc7\0\x04\
7391\0\x20[method]incoming-request.headers\x01H\x01i-\x01j\x01\xc9\0\0\x01@\x01\x04s\
7392elf\xc2\0\0\xca\0\x04\0\x20[method]incoming-request.consume\x01K\x01i'\x01@\x01\x07\
7393headers\xc7\0\0\xcc\0\x04\0\x1d[constructor]outgoing-request\x01M\x01h'\x01i0\x01\
7394j\x01\xcf\0\0\x01@\x01\x04self\xce\0\0\xd0\0\x04\0\x1d[method]outgoing-request.b\
7395ody\x01Q\x01@\x01\x04self\xce\0\0\x0b\x04\0\x1f[method]outgoing-request.method\x01\
7396R\x01j\0\0\x01@\x02\x04self\xce\0\x06method\x0b\0\xd3\0\x04\0#[method]outgoing-r\
7397equest.set-method\x01T\x01@\x01\x04self\xce\0\0\x0e\x04\0([method]outgoing-reque\
7398st.path-with-query\x01U\x01@\x02\x04self\xce\0\x0fpath-with-query\x0e\0\xd3\0\x04\
7399\0,[method]outgoing-request.set-path-with-query\x01V\x01@\x01\x04self\xce\0\0\xc5\
7400\0\x04\0\x1f[method]outgoing-request.scheme\x01W\x01@\x02\x04self\xce\0\x06schem\
7401e\xc5\0\0\xd3\0\x04\0#[method]outgoing-request.set-scheme\x01X\x04\0\"[method]ou\
7402tgoing-request.authority\x01U\x01@\x02\x04self\xce\0\x09authority\x0e\0\xd3\0\x04\
7403\0&[method]outgoing-request.set-authority\x01Y\x01@\x01\x04self\xce\0\0\xc7\0\x04\
7404\0\x20[method]outgoing-request.headers\x01Z\x01i(\x01@\0\0\xdb\0\x04\0\x1c[const\
7405ructor]request-options\x01\\\x01h(\x01k\x01\x01@\x01\x04self\xdd\0\0\xde\0\x04\0\
7406'[method]request-options.connect-timeout\x01_\x01@\x02\x04self\xdd\0\x08duration\
7407\xde\0\0\xd3\0\x04\0+[method]request-options.set-connect-timeout\x01`\x04\0*[met\
7408hod]request-options.first-byte-timeout\x01_\x04\0.[method]request-options.set-fi\
7409rst-byte-timeout\x01`\x04\0-[method]request-options.between-bytes-timeout\x01_\x04\
7410\01[method]request-options.set-between-bytes-timeout\x01`\x01i)\x01i/\x01j\x01\xe2\
7411\0\x01\x1b\x01@\x02\x05param\xe1\0\x08response\xe3\0\x01\0\x04\0\x1d[static]resp\
7412onse-outparam.set\x01d\x01h,\x01@\x01\x04self\xe5\0\0+\x04\0\x20[method]incoming\
7413-response.status\x01f\x01@\x01\x04self\xe5\0\0\xc7\0\x04\0![method]incoming-resp\
7414onse.headers\x01g\x01@\x01\x04self\xe5\0\0\xca\0\x04\0![method]incoming-response\
7415.consume\x01h\x01h-\x01i\x03\x01j\x01\xea\0\0\x01@\x01\x04self\xe9\0\0\xeb\0\x04\
7416\0\x1c[method]incoming-body.stream\x01l\x01i.\x01@\x01\x04this\xc9\0\0\xed\0\x04\
7417\0\x1c[static]incoming-body.finish\x01n\x01h.\x01i\x09\x01@\x01\x04self\xef\0\0\xf0\
7418\0\x04\0![method]future-trailers.subscribe\x01q\x01i%\x01k\xf2\0\x01j\x01\xf3\0\x01\
7419\x1b\x01j\x01\xf4\0\0\x01k\xf5\0\x01@\x01\x04self\xef\0\0\xf6\0\x04\0\x1b[method\
7420]future-trailers.get\x01w\x01@\x01\x07headers\xc7\0\0\xe2\0\x04\0\x1e[constructo\
7421r]outgoing-response\x01x\x01h/\x01@\x01\x04self\xf9\0\0+\x04\0%[method]outgoing-\
7422response.status-code\x01z\x01@\x02\x04self\xf9\0\x0bstatus-code+\0\xd3\0\x04\0)[\
7423method]outgoing-response.set-status-code\x01{\x01@\x01\x04self\xf9\0\0\xc7\0\x04\
7424\0![method]outgoing-response.headers\x01|\x01@\x01\x04self\xf9\0\0\xd0\0\x04\0\x1e\
7425[method]outgoing-response.body\x01}\x01h0\x01i\x05\x01j\x01\xff\0\0\x01@\x01\x04\
7426self\xfe\0\0\x80\x01\x04\0\x1b[method]outgoing-body.write\x01\x81\x01\x01j\0\x01\
7427\x1b\x01@\x02\x04this\xcf\0\x08trailers\xf3\0\0\x82\x01\x04\0\x1c[static]outgoin\
7428g-body.finish\x01\x83\x01\x01h1\x01@\x01\x04self\x84\x01\0\xf0\0\x04\0*[method]f\
7429uture-incoming-response.subscribe\x01\x85\x01\x01i,\x01j\x01\x86\x01\x01\x1b\x01\
7430j\x01\x87\x01\0\x01k\x88\x01\x01@\x01\x04self\x84\x01\0\x89\x01\x04\0$[method]fu\
7431ture-incoming-response.get\x01\x8a\x01\x01h\x07\x01k\x1b\x01@\x01\x03err\x8b\x01\
7432\0\x8c\x01\x04\0\x0fhttp-error-code\x01\x8d\x01\x03\0\x15wasi:http/types@0.2.4\x05\
7433\x0e\x02\x03\0\x09\x10outgoing-request\x02\x03\0\x09\x0frequest-options\x02\x03\0\
7434\x09\x18future-incoming-response\x02\x03\0\x09\x0aerror-code\x01B\x0f\x02\x03\x02\
7435\x01\x0f\x04\0\x10outgoing-request\x03\0\0\x02\x03\x02\x01\x10\x04\0\x0frequest-\
7436options\x03\0\x02\x02\x03\x02\x01\x11\x04\0\x18future-incoming-response\x03\0\x04\
7437\x02\x03\x02\x01\x12\x04\0\x0aerror-code\x03\0\x06\x01i\x01\x01i\x03\x01k\x09\x01\
7438i\x05\x01j\x01\x0b\x01\x07\x01@\x02\x07request\x08\x07options\x0a\0\x0c\x04\0\x06\
7439handle\x01\x0d\x03\0\x20wasi:http/outgoing-handler@0.2.4\x05\x13\x04\05wasi:http\
7440/proxy-with-all-of-its-exports-removed@0.2.4\x04\0\x0b+\x01\0%proxy-with-all-of-\
7441its-exports-removed\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-compo\
7442nent\x070.239.0\x10wit-bindgen-rust\x060.46.0";
7443#[inline(never)]
7444#[doc(hidden)]
7445pub fn __link_custom_section_describing_imports() {
7446    wit_bindgen::rt::maybe_link_cabi_realloc();
7447}