land_sdk/
http_service.rs

1// Generated by `wit-bindgen` 0.12.0. DO NOT EDIT!
2pub mod land {
3    pub mod http {
4
5        #[allow(clippy::all)]
6        pub mod http_types {
7            #[used]
8            #[doc(hidden)]
9            #[cfg(target_arch = "wasm32")]
10            static __FORCE_SECTION_REF: fn() = super::super::super::__link_section;
11            pub type HttpStatusCode = u16;
12            pub type HttpMethod = wit_bindgen::rt::string::String;
13            pub type HttpHeaders = wit_bindgen::rt::vec::Vec<(
14                wit_bindgen::rt::string::String,
15                wit_bindgen::rt::string::String,
16            )>;
17            pub type HttpUri = wit_bindgen::rt::string::String;
18            pub type HttpBodyHandle = u32;
19            #[derive(Clone)]
20            pub struct Request {
21                pub method: HttpMethod,
22                pub uri: HttpUri,
23                pub headers: HttpHeaders,
24                pub body: Option<HttpBodyHandle>,
25            }
26            impl ::core::fmt::Debug for Request {
27                fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
28                    f.debug_struct("Request")
29                        .field("method", &self.method)
30                        .field("uri", &self.uri)
31                        .field("headers", &self.headers)
32                        .field("body", &self.body)
33                        .finish()
34                }
35            }
36            #[derive(Clone)]
37            pub struct Response {
38                pub status: HttpStatusCode,
39                pub headers: HttpHeaders,
40                pub body: Option<HttpBodyHandle>,
41            }
42            impl ::core::fmt::Debug for Response {
43                fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
44                    f.debug_struct("Response")
45                        .field("status", &self.status)
46                        .field("headers", &self.headers)
47                        .field("body", &self.body)
48                        .finish()
49                }
50            }
51            #[repr(u8)]
52            #[derive(Clone, Copy, PartialEq, Eq)]
53            pub enum RequestError {
54                NetworkError,
55                Timeout,
56                InvalidUrl,
57                DestinationNotAllowed,
58                TooManyRequests,
59                InvalidRequest,
60            }
61            impl RequestError {
62                pub fn name(&self) -> &'static str {
63                    match self {
64                        RequestError::NetworkError => "network-error",
65                        RequestError::Timeout => "timeout",
66                        RequestError::InvalidUrl => "invalid-url",
67                        RequestError::DestinationNotAllowed => "destination-not-allowed",
68                        RequestError::TooManyRequests => "too-many-requests",
69                        RequestError::InvalidRequest => "invalid-request",
70                    }
71                }
72                pub fn message(&self) -> &'static str {
73                    match self {
74                        RequestError::NetworkError => "",
75                        RequestError::Timeout => "",
76                        RequestError::InvalidUrl => "",
77                        RequestError::DestinationNotAllowed => "",
78                        RequestError::TooManyRequests => "",
79                        RequestError::InvalidRequest => "",
80                    }
81                }
82            }
83            impl ::core::fmt::Debug for RequestError {
84                fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
85                    f.debug_struct("RequestError")
86                        .field("code", &(*self as i32))
87                        .field("name", &self.name())
88                        .field("message", &self.message())
89                        .finish()
90                }
91            }
92            impl ::core::fmt::Display for RequestError {
93                fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
94                    write!(f, "{} (error {})", self.name(), *self as i32)
95                }
96            }
97
98            impl std::error::Error for RequestError {}
99
100            impl RequestError {
101                pub(crate) unsafe fn _lift(val: u8) -> RequestError {
102                    if !cfg!(debug_assertions) {
103                        return ::core::mem::transmute(val);
104                    }
105
106                    match val {
107                        0 => RequestError::NetworkError,
108                        1 => RequestError::Timeout,
109                        2 => RequestError::InvalidUrl,
110                        3 => RequestError::DestinationNotAllowed,
111                        4 => RequestError::TooManyRequests,
112                        5 => RequestError::InvalidRequest,
113
114                        _ => panic!("invalid enum discriminant"),
115                    }
116                }
117            }
118
119            #[repr(u8)]
120            #[derive(Clone, Copy, PartialEq, Eq)]
121            pub enum RedirectPolicy {
122                Follow,
123                Error,
124                Manual,
125            }
126            impl ::core::fmt::Debug for RedirectPolicy {
127                fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
128                    match self {
129                        RedirectPolicy::Follow => f.debug_tuple("RedirectPolicy::Follow").finish(),
130                        RedirectPolicy::Error => f.debug_tuple("RedirectPolicy::Error").finish(),
131                        RedirectPolicy::Manual => f.debug_tuple("RedirectPolicy::Manual").finish(),
132                    }
133                }
134            }
135
136            impl RedirectPolicy {
137                pub(crate) unsafe fn _lift(val: u8) -> RedirectPolicy {
138                    if !cfg!(debug_assertions) {
139                        return ::core::mem::transmute(val);
140                    }
141
142                    match val {
143                        0 => RedirectPolicy::Follow,
144                        1 => RedirectPolicy::Error,
145                        2 => RedirectPolicy::Manual,
146
147                        _ => panic!("invalid enum discriminant"),
148                    }
149                }
150            }
151
152            #[repr(C)]
153            #[derive(Copy, Clone)]
154            pub struct RequestOptions {
155                pub timeout: u32,
156                pub redirect: RedirectPolicy,
157            }
158            impl ::core::fmt::Debug for RequestOptions {
159                fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
160                    f.debug_struct("RequestOptions")
161                        .field("timeout", &self.timeout)
162                        .field("redirect", &self.redirect)
163                        .finish()
164                }
165            }
166        }
167
168        #[allow(clippy::all)]
169        pub mod http_body {
170            #[used]
171            #[doc(hidden)]
172            #[cfg(target_arch = "wasm32")]
173            static __FORCE_SECTION_REF: fn() = super::super::super::__link_section;
174            pub type HttpBodyHandle = super::super::super::land::http::http_types::HttpBodyHandle;
175            /// an error type returned from a body operation.
176            #[derive(Clone)]
177            pub enum BodyError {
178                /// The body is invalid
179                InvalidHandle,
180                /// The body is only readable
181                ReadOnly,
182                /// The body read failed
183                ReadFailed(wit_bindgen::rt::string::String),
184                /// The body write failed
185                WriteFailed(wit_bindgen::rt::string::String),
186            }
187            impl ::core::fmt::Debug for BodyError {
188                fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
189                    match self {
190                        BodyError::InvalidHandle => {
191                            f.debug_tuple("BodyError::InvalidHandle").finish()
192                        }
193                        BodyError::ReadOnly => f.debug_tuple("BodyError::ReadOnly").finish(),
194                        BodyError::ReadFailed(e) => {
195                            f.debug_tuple("BodyError::ReadFailed").field(e).finish()
196                        }
197                        BodyError::WriteFailed(e) => {
198                            f.debug_tuple("BodyError::WriteFailed").field(e).finish()
199                        }
200                    }
201                }
202            }
203            impl ::core::fmt::Display for BodyError {
204                fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
205                    write!(f, "{:?}", self)
206                }
207            }
208
209            impl std::error::Error for BodyError {}
210            #[allow(clippy::all)]
211            /// Read http body bytes with size and eof flag
212            pub fn http_body_read(
213                handle: HttpBodyHandle,
214            ) -> Result<(wit_bindgen::rt::vec::Vec<u8>, bool), BodyError> {
215                #[allow(unused_imports)]
216                use wit_bindgen::rt::{alloc, string::String, vec::Vec};
217                unsafe {
218                    #[repr(align(4))]
219                    struct RetArea([u8; 16]);
220                    let mut ret_area = ::core::mem::MaybeUninit::<RetArea>::uninit();
221                    let ptr0 = ret_area.as_mut_ptr() as i32;
222                    #[cfg(target_arch = "wasm32")]
223                    #[link(wasm_import_module = "land:http/http-body")]
224                    extern "C" {
225                        #[link_name = "http-body-read"]
226                        fn wit_import(_: i32, _: i32);
227                    }
228
229                    #[cfg(not(target_arch = "wasm32"))]
230                    fn wit_import(_: i32, _: i32) {
231                        unreachable!()
232                    }
233                    wit_import(wit_bindgen::rt::as_i32(handle), ptr0);
234                    let l1 = i32::from(*((ptr0 + 0) as *const u8));
235                    match l1 {
236                        0 => {
237                            let e = {
238                                let l2 = *((ptr0 + 4) as *const i32);
239                                let l3 = *((ptr0 + 8) as *const i32);
240                                let len4 = l3 as usize;
241                                let l5 = i32::from(*((ptr0 + 12) as *const u8));
242
243                                (
244                                    Vec::from_raw_parts(l2 as *mut _, len4, len4),
245                                    wit_bindgen::rt::bool_lift(l5 as u8),
246                                )
247                            };
248                            Ok(e)
249                        }
250                        1 => {
251                            let e = {
252                                let l6 = i32::from(*((ptr0 + 4) as *const u8));
253                                let v13 = match l6 {
254                                    0 => BodyError::InvalidHandle,
255                                    1 => BodyError::ReadOnly,
256                                    2 => {
257                                        let e13 = {
258                                            let l7 = *((ptr0 + 8) as *const i32);
259                                            let l8 = *((ptr0 + 12) as *const i32);
260                                            let len9 = l8 as usize;
261                                            let bytes9 =
262                                                Vec::from_raw_parts(l7 as *mut _, len9, len9);
263
264                                            wit_bindgen::rt::string_lift(bytes9)
265                                        };
266                                        BodyError::ReadFailed(e13)
267                                    }
268                                    n => {
269                                        debug_assert_eq!(n, 3, "invalid enum discriminant");
270                                        let e13 = {
271                                            let l10 = *((ptr0 + 8) as *const i32);
272                                            let l11 = *((ptr0 + 12) as *const i32);
273                                            let len12 = l11 as usize;
274                                            let bytes12 =
275                                                Vec::from_raw_parts(l10 as *mut _, len12, len12);
276
277                                            wit_bindgen::rt::string_lift(bytes12)
278                                        };
279                                        BodyError::WriteFailed(e13)
280                                    }
281                                };
282
283                                v13
284                            };
285                            Err(e)
286                        }
287                        _ => wit_bindgen::rt::invalid_enum_discriminant(),
288                    }
289                }
290            }
291            #[allow(clippy::all)]
292            /// Readall http body bytes with size and eof flag
293            pub fn http_body_read_all(
294                handle: HttpBodyHandle,
295            ) -> Result<wit_bindgen::rt::vec::Vec<u8>, BodyError> {
296                #[allow(unused_imports)]
297                use wit_bindgen::rt::{alloc, string::String, vec::Vec};
298                unsafe {
299                    #[repr(align(4))]
300                    struct RetArea([u8; 16]);
301                    let mut ret_area = ::core::mem::MaybeUninit::<RetArea>::uninit();
302                    let ptr0 = ret_area.as_mut_ptr() as i32;
303                    #[cfg(target_arch = "wasm32")]
304                    #[link(wasm_import_module = "land:http/http-body")]
305                    extern "C" {
306                        #[link_name = "http-body-read-all"]
307                        fn wit_import(_: i32, _: i32);
308                    }
309
310                    #[cfg(not(target_arch = "wasm32"))]
311                    fn wit_import(_: i32, _: i32) {
312                        unreachable!()
313                    }
314                    wit_import(wit_bindgen::rt::as_i32(handle), ptr0);
315                    let l1 = i32::from(*((ptr0 + 0) as *const u8));
316                    match l1 {
317                        0 => {
318                            let e = {
319                                let l2 = *((ptr0 + 4) as *const i32);
320                                let l3 = *((ptr0 + 8) as *const i32);
321                                let len4 = l3 as usize;
322
323                                Vec::from_raw_parts(l2 as *mut _, len4, len4)
324                            };
325                            Ok(e)
326                        }
327                        1 => {
328                            let e = {
329                                let l5 = i32::from(*((ptr0 + 4) as *const u8));
330                                let v12 = match l5 {
331                                    0 => BodyError::InvalidHandle,
332                                    1 => BodyError::ReadOnly,
333                                    2 => {
334                                        let e12 = {
335                                            let l6 = *((ptr0 + 8) as *const i32);
336                                            let l7 = *((ptr0 + 12) as *const i32);
337                                            let len8 = l7 as usize;
338                                            let bytes8 =
339                                                Vec::from_raw_parts(l6 as *mut _, len8, len8);
340
341                                            wit_bindgen::rt::string_lift(bytes8)
342                                        };
343                                        BodyError::ReadFailed(e12)
344                                    }
345                                    n => {
346                                        debug_assert_eq!(n, 3, "invalid enum discriminant");
347                                        let e12 = {
348                                            let l9 = *((ptr0 + 8) as *const i32);
349                                            let l10 = *((ptr0 + 12) as *const i32);
350                                            let len11 = l10 as usize;
351                                            let bytes11 =
352                                                Vec::from_raw_parts(l9 as *mut _, len11, len11);
353
354                                            wit_bindgen::rt::string_lift(bytes11)
355                                        };
356                                        BodyError::WriteFailed(e12)
357                                    }
358                                };
359
360                                v12
361                            };
362                            Err(e)
363                        }
364                        _ => wit_bindgen::rt::invalid_enum_discriminant(),
365                    }
366                }
367            }
368            #[allow(clippy::all)]
369            /// Write http body bytes, return written bytes length
370            pub fn http_body_write(handle: HttpBodyHandle, data: &[u8]) -> Result<u64, BodyError> {
371                #[allow(unused_imports)]
372                use wit_bindgen::rt::{alloc, string::String, vec::Vec};
373                unsafe {
374                    #[repr(align(8))]
375                    struct RetArea([u8; 24]);
376                    let mut ret_area = ::core::mem::MaybeUninit::<RetArea>::uninit();
377                    let vec0 = data;
378                    let ptr0 = vec0.as_ptr() as i32;
379                    let len0 = vec0.len() as i32;
380                    let ptr1 = ret_area.as_mut_ptr() as i32;
381                    #[cfg(target_arch = "wasm32")]
382                    #[link(wasm_import_module = "land:http/http-body")]
383                    extern "C" {
384                        #[link_name = "http-body-write"]
385                        fn wit_import(_: i32, _: i32, _: i32, _: i32);
386                    }
387
388                    #[cfg(not(target_arch = "wasm32"))]
389                    fn wit_import(_: i32, _: i32, _: i32, _: i32) {
390                        unreachable!()
391                    }
392                    wit_import(wit_bindgen::rt::as_i32(handle), ptr0, len0, ptr1);
393                    let l2 = i32::from(*((ptr1 + 0) as *const u8));
394                    match l2 {
395                        0 => {
396                            let e = {
397                                let l3 = *((ptr1 + 8) as *const i64);
398
399                                l3 as u64
400                            };
401                            Ok(e)
402                        }
403                        1 => {
404                            let e = {
405                                let l4 = i32::from(*((ptr1 + 8) as *const u8));
406                                let v11 = match l4 {
407                                    0 => BodyError::InvalidHandle,
408                                    1 => BodyError::ReadOnly,
409                                    2 => {
410                                        let e11 = {
411                                            let l5 = *((ptr1 + 12) as *const i32);
412                                            let l6 = *((ptr1 + 16) as *const i32);
413                                            let len7 = l6 as usize;
414                                            let bytes7 =
415                                                Vec::from_raw_parts(l5 as *mut _, len7, len7);
416
417                                            wit_bindgen::rt::string_lift(bytes7)
418                                        };
419                                        BodyError::ReadFailed(e11)
420                                    }
421                                    n => {
422                                        debug_assert_eq!(n, 3, "invalid enum discriminant");
423                                        let e11 = {
424                                            let l8 = *((ptr1 + 12) as *const i32);
425                                            let l9 = *((ptr1 + 16) as *const i32);
426                                            let len10 = l9 as usize;
427                                            let bytes10 =
428                                                Vec::from_raw_parts(l8 as *mut _, len10, len10);
429
430                                            wit_bindgen::rt::string_lift(bytes10)
431                                        };
432                                        BodyError::WriteFailed(e11)
433                                    }
434                                };
435
436                                v11
437                            };
438                            Err(e)
439                        }
440                        _ => wit_bindgen::rt::invalid_enum_discriminant(),
441                    }
442                }
443            }
444            #[allow(clippy::all)]
445            /// Accquire http body and get http body handle
446            pub fn http_body_new() -> Result<HttpBodyHandle, BodyError> {
447                #[allow(unused_imports)]
448                use wit_bindgen::rt::{alloc, string::String, vec::Vec};
449                unsafe {
450                    #[repr(align(4))]
451                    struct RetArea([u8; 16]);
452                    let mut ret_area = ::core::mem::MaybeUninit::<RetArea>::uninit();
453                    let ptr0 = ret_area.as_mut_ptr() as i32;
454                    #[cfg(target_arch = "wasm32")]
455                    #[link(wasm_import_module = "land:http/http-body")]
456                    extern "C" {
457                        #[link_name = "http-body-new"]
458                        fn wit_import(_: i32);
459                    }
460
461                    #[cfg(not(target_arch = "wasm32"))]
462                    fn wit_import(_: i32) {
463                        unreachable!()
464                    }
465                    wit_import(ptr0);
466                    let l1 = i32::from(*((ptr0 + 0) as *const u8));
467                    match l1 {
468                        0 => {
469                            let e = {
470                                let l2 = *((ptr0 + 4) as *const i32);
471
472                                l2 as u32
473                            };
474                            Ok(e)
475                        }
476                        1 => {
477                            let e = {
478                                let l3 = i32::from(*((ptr0 + 4) as *const u8));
479                                let v10 = match l3 {
480                                    0 => BodyError::InvalidHandle,
481                                    1 => BodyError::ReadOnly,
482                                    2 => {
483                                        let e10 = {
484                                            let l4 = *((ptr0 + 8) as *const i32);
485                                            let l5 = *((ptr0 + 12) as *const i32);
486                                            let len6 = l5 as usize;
487                                            let bytes6 =
488                                                Vec::from_raw_parts(l4 as *mut _, len6, len6);
489
490                                            wit_bindgen::rt::string_lift(bytes6)
491                                        };
492                                        BodyError::ReadFailed(e10)
493                                    }
494                                    n => {
495                                        debug_assert_eq!(n, 3, "invalid enum discriminant");
496                                        let e10 = {
497                                            let l7 = *((ptr0 + 8) as *const i32);
498                                            let l8 = *((ptr0 + 12) as *const i32);
499                                            let len9 = l8 as usize;
500                                            let bytes9 =
501                                                Vec::from_raw_parts(l7 as *mut _, len9, len9);
502
503                                            wit_bindgen::rt::string_lift(bytes9)
504                                        };
505                                        BodyError::WriteFailed(e10)
506                                    }
507                                };
508
509                                v10
510                            };
511                            Err(e)
512                        }
513                        _ => wit_bindgen::rt::invalid_enum_discriminant(),
514                    }
515                }
516            }
517            #[allow(clippy::all)]
518            /// Accquire http body and get http body handle
519            pub fn http_body_new_stream() -> Result<HttpBodyHandle, BodyError> {
520                #[allow(unused_imports)]
521                use wit_bindgen::rt::{alloc, string::String, vec::Vec};
522                unsafe {
523                    #[repr(align(4))]
524                    struct RetArea([u8; 16]);
525                    let mut ret_area = ::core::mem::MaybeUninit::<RetArea>::uninit();
526                    let ptr0 = ret_area.as_mut_ptr() as i32;
527                    #[cfg(target_arch = "wasm32")]
528                    #[link(wasm_import_module = "land:http/http-body")]
529                    extern "C" {
530                        #[link_name = "http-body-new-stream"]
531                        fn wit_import(_: i32);
532                    }
533
534                    #[cfg(not(target_arch = "wasm32"))]
535                    fn wit_import(_: i32) {
536                        unreachable!()
537                    }
538                    wit_import(ptr0);
539                    let l1 = i32::from(*((ptr0 + 0) as *const u8));
540                    match l1 {
541                        0 => {
542                            let e = {
543                                let l2 = *((ptr0 + 4) as *const i32);
544
545                                l2 as u32
546                            };
547                            Ok(e)
548                        }
549                        1 => {
550                            let e = {
551                                let l3 = i32::from(*((ptr0 + 4) as *const u8));
552                                let v10 = match l3 {
553                                    0 => BodyError::InvalidHandle,
554                                    1 => BodyError::ReadOnly,
555                                    2 => {
556                                        let e10 = {
557                                            let l4 = *((ptr0 + 8) as *const i32);
558                                            let l5 = *((ptr0 + 12) as *const i32);
559                                            let len6 = l5 as usize;
560                                            let bytes6 =
561                                                Vec::from_raw_parts(l4 as *mut _, len6, len6);
562
563                                            wit_bindgen::rt::string_lift(bytes6)
564                                        };
565                                        BodyError::ReadFailed(e10)
566                                    }
567                                    n => {
568                                        debug_assert_eq!(n, 3, "invalid enum discriminant");
569                                        let e10 = {
570                                            let l7 = *((ptr0 + 8) as *const i32);
571                                            let l8 = *((ptr0 + 12) as *const i32);
572                                            let len9 = l8 as usize;
573                                            let bytes9 =
574                                                Vec::from_raw_parts(l7 as *mut _, len9, len9);
575
576                                            wit_bindgen::rt::string_lift(bytes9)
577                                        };
578                                        BodyError::WriteFailed(e10)
579                                    }
580                                };
581
582                                v10
583                            };
584                            Err(e)
585                        }
586                        _ => wit_bindgen::rt::invalid_enum_discriminant(),
587                    }
588                }
589            }
590        }
591
592        #[allow(clippy::all)]
593        pub mod http_outgoing {
594            #[used]
595            #[doc(hidden)]
596            #[cfg(target_arch = "wasm32")]
597            static __FORCE_SECTION_REF: fn() = super::super::super::__link_section;
598            pub type Request = super::super::super::land::http::http_types::Request;
599            pub type Response = super::super::super::land::http::http_types::Response;
600            pub type RequestError = super::super::super::land::http::http_types::RequestError;
601            pub type RequestOptions = super::super::super::land::http::http_types::RequestOptions;
602            #[allow(clippy::all)]
603            pub fn fetch_request(
604                req: &Request,
605                options: RequestOptions,
606            ) -> Result<Response, RequestError> {
607                #[allow(unused_imports)]
608                use wit_bindgen::rt::{alloc, string::String, vec::Vec};
609                unsafe {
610                    #[repr(align(4))]
611                    struct RetArea([u8; 24]);
612                    let mut ret_area = ::core::mem::MaybeUninit::<RetArea>::uninit();
613                    let super::super::super::land::http::http_types::Request {
614                        method: method0,
615                        uri: uri0,
616                        headers: headers0,
617                        body: body0,
618                    } = req;
619                    let vec1 = method0;
620                    let ptr1 = vec1.as_ptr() as i32;
621                    let len1 = vec1.len() as i32;
622                    let vec2 = uri0;
623                    let ptr2 = vec2.as_ptr() as i32;
624                    let len2 = vec2.len() as i32;
625                    let vec6 = headers0;
626                    let len6 = vec6.len() as i32;
627                    let layout6 = alloc::Layout::from_size_align_unchecked(vec6.len() * 16, 4);
628                    let result6 = if layout6.size() != 0 {
629                        let ptr = alloc::alloc(layout6);
630                        if ptr.is_null() {
631                            alloc::handle_alloc_error(layout6);
632                        }
633                        ptr
634                    } else {
635                        ::core::ptr::null_mut()
636                    };
637                    for (i, e) in vec6.into_iter().enumerate() {
638                        let base = result6 as i32 + (i as i32) * 16;
639                        {
640                            let (t3_0, t3_1) = e;
641                            let vec4 = t3_0;
642                            let ptr4 = vec4.as_ptr() as i32;
643                            let len4 = vec4.len() as i32;
644                            *((base + 4) as *mut i32) = len4;
645                            *((base + 0) as *mut i32) = ptr4;
646                            let vec5 = t3_1;
647                            let ptr5 = vec5.as_ptr() as i32;
648                            let len5 = vec5.len() as i32;
649                            *((base + 12) as *mut i32) = len5;
650                            *((base + 8) as *mut i32) = ptr5;
651                        }
652                    }
653                    let (result7_0, result7_1) = match body0 {
654                        Some(e) => (1i32, wit_bindgen::rt::as_i32(e)),
655                        None => (0i32, 0i32),
656                    };
657                    let super::super::super::land::http::http_types::RequestOptions {
658                        timeout: timeout8,
659                        redirect: redirect8,
660                    } = options;
661                    let ptr9 = ret_area.as_mut_ptr() as i32;
662                    #[cfg(target_arch = "wasm32")]
663                    #[link(wasm_import_module = "land:http/http-outgoing")]
664                    extern "C" {
665                        #[link_name = "fetch-request"]
666                        fn wit_import(
667                            _: i32,
668                            _: i32,
669                            _: i32,
670                            _: i32,
671                            _: i32,
672                            _: i32,
673                            _: i32,
674                            _: i32,
675                            _: i32,
676                            _: i32,
677                            _: i32,
678                        );
679                    }
680
681                    #[cfg(not(target_arch = "wasm32"))]
682                    fn wit_import(
683                        _: i32,
684                        _: i32,
685                        _: i32,
686                        _: i32,
687                        _: i32,
688                        _: i32,
689                        _: i32,
690                        _: i32,
691                        _: i32,
692                        _: i32,
693                        _: i32,
694                    ) {
695                        unreachable!()
696                    }
697                    wit_import(
698                        ptr1,
699                        len1,
700                        ptr2,
701                        len2,
702                        result6 as i32,
703                        len6,
704                        result7_0,
705                        result7_1,
706                        wit_bindgen::rt::as_i32(timeout8),
707                        redirect8.clone() as i32,
708                        ptr9,
709                    );
710                    let l10 = i32::from(*((ptr9 + 0) as *const u8));
711                    if layout6.size() != 0 {
712                        alloc::dealloc(result6, layout6);
713                    }
714                    match l10 {
715                        0 => {
716                            let e = {
717                                let l11 = i32::from(*((ptr9 + 4) as *const u16));
718                                let l12 = *((ptr9 + 8) as *const i32);
719                                let l13 = *((ptr9 + 12) as *const i32);
720                                let base20 = l12;
721                                let len20 = l13;
722                                let mut result20 = Vec::with_capacity(len20 as usize);
723                                for i in 0..len20 {
724                                    let base = base20 + i * 16;
725                                    let e20 = {
726                                        let l14 = *((base + 0) as *const i32);
727                                        let l15 = *((base + 4) as *const i32);
728                                        let len16 = l15 as usize;
729                                        let bytes16 =
730                                            Vec::from_raw_parts(l14 as *mut _, len16, len16);
731                                        let l17 = *((base + 8) as *const i32);
732                                        let l18 = *((base + 12) as *const i32);
733                                        let len19 = l18 as usize;
734                                        let bytes19 =
735                                            Vec::from_raw_parts(l17 as *mut _, len19, len19);
736
737                                        (
738                                            wit_bindgen::rt::string_lift(bytes16),
739                                            wit_bindgen::rt::string_lift(bytes19),
740                                        )
741                                    };
742                                    result20.push(e20);
743                                }
744                                wit_bindgen::rt::dealloc(base20, (len20 as usize) * 16, 4);
745                                let l21 = i32::from(*((ptr9 + 16) as *const u8));
746
747                                super::super::super::land::http::http_types::Response {
748                                    status: l11 as u16,
749                                    headers: result20,
750                                    body: match l21 {
751                                        0 => None,
752                                        1 => {
753                                            let e = {
754                                                let l22 = *((ptr9 + 20) as *const i32);
755
756                                                l22 as u32
757                                            };
758                                            Some(e)
759                                        }
760                                        _ => wit_bindgen::rt::invalid_enum_discriminant(),
761                                    },
762                                }
763                            };
764                            Ok(e)
765                        }
766                        1 => {
767                            let e = {
768                                let l23 = i32::from(*((ptr9 + 4) as *const u8));
769
770                                super::super::super::land::http::http_types::RequestError::_lift(
771                                    l23 as u8,
772                                )
773                            };
774                            Err(e)
775                        }
776                        _ => wit_bindgen::rt::invalid_enum_discriminant(),
777                    }
778                }
779            }
780        }
781    }
782}
783
784#[cfg(target_arch = "wasm32")]
785#[link_section = "component-type:http-service"]
786#[doc(hidden)]
787pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1755] = [
788    3, 0, 12, 104, 116, 116, 112, 45, 115, 101, 114, 118, 105, 99, 101, 0, 97, 115, 109, 13, 0, 1,
789    0, 7, 204, 12, 1, 65, 4, 1, 65, 6, 1, 66, 22, 1, 123, 4, 0, 16, 104, 116, 116, 112, 45, 115,
790    116, 97, 116, 117, 115, 45, 99, 111, 100, 101, 3, 0, 0, 1, 115, 4, 0, 11, 104, 116, 116, 112,
791    45, 109, 101, 116, 104, 111, 100, 3, 0, 2, 1, 111, 2, 115, 115, 1, 112, 4, 4, 0, 12, 104, 116,
792    116, 112, 45, 104, 101, 97, 100, 101, 114, 115, 3, 0, 5, 1, 115, 4, 0, 8, 104, 116, 116, 112,
793    45, 117, 114, 105, 3, 0, 7, 1, 121, 4, 0, 16, 104, 116, 116, 112, 45, 98, 111, 100, 121, 45,
794    104, 97, 110, 100, 108, 101, 3, 0, 9, 1, 107, 10, 1, 114, 4, 6, 109, 101, 116, 104, 111, 100,
795    3, 3, 117, 114, 105, 8, 7, 104, 101, 97, 100, 101, 114, 115, 6, 4, 98, 111, 100, 121, 11, 4, 0,
796    7, 114, 101, 113, 117, 101, 115, 116, 3, 0, 12, 1, 114, 3, 6, 115, 116, 97, 116, 117, 115, 1,
797    7, 104, 101, 97, 100, 101, 114, 115, 6, 4, 98, 111, 100, 121, 11, 4, 0, 8, 114, 101, 115, 112,
798    111, 110, 115, 101, 3, 0, 14, 1, 109, 6, 13, 110, 101, 116, 119, 111, 114, 107, 45, 101, 114,
799    114, 111, 114, 7, 116, 105, 109, 101, 111, 117, 116, 11, 105, 110, 118, 97, 108, 105, 100, 45,
800    117, 114, 108, 23, 100, 101, 115, 116, 105, 110, 97, 116, 105, 111, 110, 45, 110, 111, 116, 45,
801    97, 108, 108, 111, 119, 101, 100, 17, 116, 111, 111, 45, 109, 97, 110, 121, 45, 114, 101, 113,
802    117, 101, 115, 116, 115, 15, 105, 110, 118, 97, 108, 105, 100, 45, 114, 101, 113, 117, 101,
803    115, 116, 4, 0, 13, 114, 101, 113, 117, 101, 115, 116, 45, 101, 114, 114, 111, 114, 3, 0, 16,
804    1, 109, 3, 6, 102, 111, 108, 108, 111, 119, 5, 101, 114, 114, 111, 114, 6, 109, 97, 110, 117,
805    97, 108, 4, 0, 15, 114, 101, 100, 105, 114, 101, 99, 116, 45, 112, 111, 108, 105, 99, 121, 3,
806    0, 18, 1, 114, 2, 7, 116, 105, 109, 101, 111, 117, 116, 121, 8, 114, 101, 100, 105, 114, 101,
807    99, 116, 19, 4, 0, 15, 114, 101, 113, 117, 101, 115, 116, 45, 111, 112, 116, 105, 111, 110,
808    115, 3, 0, 20, 3, 1, 20, 108, 97, 110, 100, 58, 104, 116, 116, 112, 47, 104, 116, 116, 112, 45,
809    116, 121, 112, 101, 115, 5, 0, 2, 3, 0, 0, 7, 114, 101, 113, 117, 101, 115, 116, 2, 3, 0, 0, 8,
810    114, 101, 115, 112, 111, 110, 115, 101, 1, 66, 6, 2, 3, 2, 1, 1, 4, 0, 7, 114, 101, 113, 117,
811    101, 115, 116, 3, 0, 0, 2, 3, 2, 1, 2, 4, 0, 8, 114, 101, 115, 112, 111, 110, 115, 101, 3, 0,
812    2, 1, 64, 1, 3, 114, 101, 113, 1, 0, 3, 4, 0, 14, 104, 97, 110, 100, 108, 101, 45, 114, 101,
813    113, 117, 101, 115, 116, 1, 4, 4, 1, 23, 108, 97, 110, 100, 58, 104, 116, 116, 112, 47, 104,
814    116, 116, 112, 45, 105, 110, 99, 111, 109, 105, 110, 103, 5, 3, 4, 1, 28, 108, 97, 110, 100,
815    58, 115, 101, 114, 118, 101, 114, 108, 101, 115, 115, 47, 104, 116, 116, 112, 45, 104, 97, 110,
816    100, 108, 101, 114, 4, 0, 1, 65, 11, 1, 66, 22, 1, 123, 4, 0, 16, 104, 116, 116, 112, 45, 115,
817    116, 97, 116, 117, 115, 45, 99, 111, 100, 101, 3, 0, 0, 1, 115, 4, 0, 11, 104, 116, 116, 112,
818    45, 109, 101, 116, 104, 111, 100, 3, 0, 2, 1, 111, 2, 115, 115, 1, 112, 4, 4, 0, 12, 104, 116,
819    116, 112, 45, 104, 101, 97, 100, 101, 114, 115, 3, 0, 5, 1, 115, 4, 0, 8, 104, 116, 116, 112,
820    45, 117, 114, 105, 3, 0, 7, 1, 121, 4, 0, 16, 104, 116, 116, 112, 45, 98, 111, 100, 121, 45,
821    104, 97, 110, 100, 108, 101, 3, 0, 9, 1, 107, 10, 1, 114, 4, 6, 109, 101, 116, 104, 111, 100,
822    3, 3, 117, 114, 105, 8, 7, 104, 101, 97, 100, 101, 114, 115, 6, 4, 98, 111, 100, 121, 11, 4, 0,
823    7, 114, 101, 113, 117, 101, 115, 116, 3, 0, 12, 1, 114, 3, 6, 115, 116, 97, 116, 117, 115, 1,
824    7, 104, 101, 97, 100, 101, 114, 115, 6, 4, 98, 111, 100, 121, 11, 4, 0, 8, 114, 101, 115, 112,
825    111, 110, 115, 101, 3, 0, 14, 1, 109, 6, 13, 110, 101, 116, 119, 111, 114, 107, 45, 101, 114,
826    114, 111, 114, 7, 116, 105, 109, 101, 111, 117, 116, 11, 105, 110, 118, 97, 108, 105, 100, 45,
827    117, 114, 108, 23, 100, 101, 115, 116, 105, 110, 97, 116, 105, 111, 110, 45, 110, 111, 116, 45,
828    97, 108, 108, 111, 119, 101, 100, 17, 116, 111, 111, 45, 109, 97, 110, 121, 45, 114, 101, 113,
829    117, 101, 115, 116, 115, 15, 105, 110, 118, 97, 108, 105, 100, 45, 114, 101, 113, 117, 101,
830    115, 116, 4, 0, 13, 114, 101, 113, 117, 101, 115, 116, 45, 101, 114, 114, 111, 114, 3, 0, 16,
831    1, 109, 3, 6, 102, 111, 108, 108, 111, 119, 5, 101, 114, 114, 111, 114, 6, 109, 97, 110, 117,
832    97, 108, 4, 0, 15, 114, 101, 100, 105, 114, 101, 99, 116, 45, 112, 111, 108, 105, 99, 121, 3,
833    0, 18, 1, 114, 2, 7, 116, 105, 109, 101, 111, 117, 116, 121, 8, 114, 101, 100, 105, 114, 101,
834    99, 116, 19, 4, 0, 15, 114, 101, 113, 117, 101, 115, 116, 45, 111, 112, 116, 105, 111, 110,
835    115, 3, 0, 20, 3, 1, 20, 108, 97, 110, 100, 58, 104, 116, 116, 112, 47, 104, 116, 116, 112, 45,
836    116, 121, 112, 101, 115, 5, 0, 2, 3, 0, 0, 16, 104, 116, 116, 112, 45, 98, 111, 100, 121, 45,
837    104, 97, 110, 100, 108, 101, 1, 66, 19, 2, 3, 2, 1, 1, 4, 0, 16, 104, 116, 116, 112, 45, 98,
838    111, 100, 121, 45, 104, 97, 110, 100, 108, 101, 3, 0, 0, 1, 113, 4, 14, 105, 110, 118, 97, 108,
839    105, 100, 45, 104, 97, 110, 100, 108, 101, 0, 0, 9, 114, 101, 97, 100, 45, 111, 110, 108, 121,
840    0, 0, 11, 114, 101, 97, 100, 45, 102, 97, 105, 108, 101, 100, 1, 115, 0, 12, 119, 114, 105,
841    116, 101, 45, 102, 97, 105, 108, 101, 100, 1, 115, 0, 4, 0, 10, 98, 111, 100, 121, 45, 101,
842    114, 114, 111, 114, 3, 0, 2, 1, 112, 125, 1, 111, 2, 4, 127, 1, 106, 1, 5, 1, 3, 1, 64, 1, 6,
843    104, 97, 110, 100, 108, 101, 1, 0, 6, 4, 0, 14, 104, 116, 116, 112, 45, 98, 111, 100, 121, 45,
844    114, 101, 97, 100, 1, 7, 1, 106, 1, 4, 1, 3, 1, 64, 1, 6, 104, 97, 110, 100, 108, 101, 1, 0, 8,
845    4, 0, 18, 104, 116, 116, 112, 45, 98, 111, 100, 121, 45, 114, 101, 97, 100, 45, 97, 108, 108,
846    1, 9, 1, 106, 1, 119, 1, 3, 1, 64, 2, 6, 104, 97, 110, 100, 108, 101, 1, 4, 100, 97, 116, 97,
847    4, 0, 10, 4, 0, 15, 104, 116, 116, 112, 45, 98, 111, 100, 121, 45, 119, 114, 105, 116, 101, 1,
848    11, 1, 106, 1, 1, 1, 3, 1, 64, 0, 0, 12, 4, 0, 13, 104, 116, 116, 112, 45, 98, 111, 100, 121,
849    45, 110, 101, 119, 1, 13, 4, 0, 20, 104, 116, 116, 112, 45, 98, 111, 100, 121, 45, 110, 101,
850    119, 45, 115, 116, 114, 101, 97, 109, 1, 13, 3, 1, 19, 108, 97, 110, 100, 58, 104, 116, 116,
851    112, 47, 104, 116, 116, 112, 45, 98, 111, 100, 121, 5, 2, 2, 3, 0, 0, 7, 114, 101, 113, 117,
852    101, 115, 116, 2, 3, 0, 0, 8, 114, 101, 115, 112, 111, 110, 115, 101, 2, 3, 0, 0, 13, 114, 101,
853    113, 117, 101, 115, 116, 45, 101, 114, 114, 111, 114, 2, 3, 0, 0, 15, 114, 101, 113, 117, 101,
854    115, 116, 45, 111, 112, 116, 105, 111, 110, 115, 1, 66, 11, 2, 3, 2, 1, 3, 4, 0, 7, 114, 101,
855    113, 117, 101, 115, 116, 3, 0, 0, 2, 3, 2, 1, 4, 4, 0, 8, 114, 101, 115, 112, 111, 110, 115,
856    101, 3, 0, 2, 2, 3, 2, 1, 5, 4, 0, 13, 114, 101, 113, 117, 101, 115, 116, 45, 101, 114, 114,
857    111, 114, 3, 0, 4, 2, 3, 2, 1, 6, 4, 0, 15, 114, 101, 113, 117, 101, 115, 116, 45, 111, 112,
858    116, 105, 111, 110, 115, 3, 0, 6, 1, 106, 1, 3, 1, 5, 1, 64, 2, 3, 114, 101, 113, 1, 7, 111,
859    112, 116, 105, 111, 110, 115, 7, 0, 8, 4, 0, 13, 102, 101, 116, 99, 104, 45, 114, 101, 113,
860    117, 101, 115, 116, 1, 9, 3, 1, 23, 108, 97, 110, 100, 58, 104, 116, 116, 112, 47, 104, 116,
861    116, 112, 45, 111, 117, 116, 103, 111, 105, 110, 103, 5, 7, 4, 1, 28, 108, 97, 110, 100, 58,
862    115, 101, 114, 118, 101, 114, 108, 101, 115, 115, 47, 104, 116, 116, 112, 45, 115, 101, 114,
863    118, 105, 99, 101, 4, 1, 11, 25, 1, 1, 19, 108, 97, 110, 100, 58, 115, 101, 114, 118, 101, 114,
864    108, 101, 115, 115, 47, 119, 105, 116, 3, 0, 0, 0, 16, 12, 112, 97, 99, 107, 97, 103, 101, 45,
865    100, 111, 99, 115, 0, 123, 125, 0, 70, 9, 112, 114, 111, 100, 117, 99, 101, 114, 115, 1, 12,
866    112, 114, 111, 99, 101, 115, 115, 101, 100, 45, 98, 121, 2, 13, 119, 105, 116, 45, 99, 111,
867    109, 112, 111, 110, 101, 110, 116, 6, 48, 46, 49, 52, 46, 53, 16, 119, 105, 116, 45, 98, 105,
868    110, 100, 103, 101, 110, 45, 114, 117, 115, 116, 6, 48, 46, 49, 50, 46, 48,
869];
870
871#[inline(never)]
872#[doc(hidden)]
873#[cfg(target_arch = "wasm32")]
874pub fn __link_section() {}