1 //! Raw bindings to the `wasi:http` package.
2 
3 #[expect(missing_docs, reason = "bindgen-generated code")]
4 mod generated {
5     use crate::p2::body;
6     use crate::p2::types;
7 
8     wasmtime::component::bindgen!({
9         path: "wit",
10         world: "wasi:http/proxy",
11         imports: { default: tracing | trappable },
12         exports: { default: async },
13         require_store_data_send: true,
14         with: {
15             // Upstream package dependencies
16             "wasi:io": wasmtime_wasi::p2::bindings::io,
17 
18             // Configure all WIT http resources to be defined types in this
19             // crate to use the `ResourceTable` helper methods.
20             "wasi:http/types.outgoing-body": body::HostOutgoingBody,
21             "wasi:http/types.future-incoming-response": types::HostFutureIncomingResponse,
22             "wasi:http/types.outgoing-response": types::HostOutgoingResponse,
23             "wasi:http/types.future-trailers": body::HostFutureTrailers,
24             "wasi:http/types.incoming-body": body::HostIncomingBody,
25             "wasi:http/types.incoming-response": types::HostIncomingResponse,
26             "wasi:http/types.response-outparam": types::HostResponseOutparam,
27             "wasi:http/types.outgoing-request": types::HostOutgoingRequest,
28             "wasi:http/types.incoming-request": types::HostIncomingRequest,
29             "wasi:http/types.fields": crate::FieldMap,
30             "wasi:http/types.request-options": types::HostRequestOptions,
31         },
32         trappable_error_type: {
33             "wasi:http/types.error-code" => crate::p2::HttpError,
34             "wasi:http/types.header-error" => crate::p2::HeaderError,
35         },
36     });
37 }
38 
39 pub use self::generated::wasi::*;
40 
41 /// Raw bindings to the `wasi:http/proxy` exports.
42 pub use self::generated::exports;
43 
44 /// Bindings to the `wasi:http/proxy` world.
45 pub use self::generated::{LinkOptions, Proxy, ProxyIndices, ProxyPre};
46 
47 /// Sync implementation of the `wasi:http/proxy` world.
48 pub mod sync {
49     #[expect(missing_docs, reason = "bindgen-generated code")]
50     mod generated {
51         wasmtime::component::bindgen!({
52             world: "wasi:http/proxy",
53             imports: { default: tracing },
54             with: {
55                 // http is in this crate
56                 "wasi:http": crate::p2::bindings::http,
57                 // sync requires the wrapper in the wasmtime_wasi crate, in
58                 // order to have in_tokio
59                 "wasi:io": wasmtime_wasi::p2::bindings::sync::io,
60             },
61             require_store_data_send: true,
62         });
63     }
64 
65     pub use self::generated::wasi::*;
66 
67     /// Raw bindings to the `wasi:http/proxy` exports.
68     pub use self::generated::exports;
69 
70     /// Bindings to the `wasi:http/proxy` world.
71     pub use self::generated::{Proxy, ProxyIndices, ProxyPre};
72 }
73