Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/wasi-http/src/bindings.rs
1692 views
1
//! Raw bindings to the `wasi:http` package.
2
3
#[expect(missing_docs, reason = "bindgen-generated code")]
4
mod generated {
5
use crate::body;
6
use crate::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": types::HostFields,
30
"wasi:http/types/request-options": types::HostRequestOptions,
31
},
32
trappable_error_type: {
33
"wasi:http/types/error-code" => crate::HttpError,
34
},
35
});
36
}
37
38
pub use self::generated::wasi::*;
39
40
/// Raw bindings to the `wasi:http/proxy` exports.
41
pub use self::generated::exports;
42
43
/// Bindings to the `wasi:http/proxy` world.
44
pub use self::generated::{LinkOptions, Proxy, ProxyIndices, ProxyPre};
45
46
/// Sync implementation of the `wasi:http/proxy` world.
47
pub mod sync {
48
#[expect(missing_docs, reason = "bindgen-generated code")]
49
mod generated {
50
wasmtime::component::bindgen!({
51
world: "wasi:http/proxy",
52
imports: { default: tracing },
53
with: {
54
// http is in this crate
55
"wasi:http": crate::bindings::http,
56
// sync requires the wrapper in the wasmtime_wasi crate, in
57
// order to have in_tokio
58
"wasi:io": wasmtime_wasi::p2::bindings::sync::io,
59
},
60
require_store_data_send: true,
61
});
62
}
63
64
pub use self::generated::wasi::*;
65
66
/// Raw bindings to the `wasi:http/proxy` exports.
67
pub use self::generated::exports;
68
69
/// Bindings to the `wasi:http/proxy` world.
70
pub use self::generated::{Proxy, ProxyIndices, ProxyPre};
71
}
72
73