Skip to content

Commit 94e95e6

Browse files
committed
chore: explicitly select p2 bindings
Signed-off-by: Roman Volosatovs <[email protected]>
1 parent 29b9cad commit 94e95e6

31 files changed

+151
-151
lines changed

crates/wasi-http/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl fmt::Display for HttpError {
5959
impl Error for HttpError {}
6060

6161
pub(crate) fn dns_error(rcode: String, info_code: u16) -> ErrorCode {
62-
ErrorCode::DnsError(crate::bindings::http::types::DnsErrorPayload {
62+
ErrorCode::DnsError(crate::p2::bindings::http::types::DnsErrorPayload {
6363
rcode: Some(rcode),
6464
info_code: Some(info_code),
6565
})

crates/wasi-http/src/p2/bindings.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ mod generated {
1919
require_store_data_send: true,
2020
with: {
2121
// Upstream package dependencies
22-
"wasi:io": wasmtime_wasi::bindings::io,
22+
"wasi:io": wasmtime_wasi::p2::bindings::io,
2323

2424
// Configure all WIT http resources to be defined types in this
2525
// crate to use the `ResourceTable` helper methods.
@@ -61,8 +61,8 @@ pub mod sync {
6161
async: false,
6262
with: {
6363
"wasi:http": crate::p2::bindings::http, // http is in this crate
64-
"wasi:io": wasmtime_wasi::bindings::sync::io, // io is sync
65-
"wasi": wasmtime_wasi::bindings, // everything else
64+
"wasi:io": wasmtime_wasi::p2::bindings::sync::io, // io is sync
65+
"wasi": wasmtime_wasi::p2::bindings, // everything else
6666
},
6767
require_store_data_send: true,
6868
});

crates/wasi-http/src/p2/mod.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ where
7878
{
7979
let io_closure = type_annotate_io::<T, _>(|t| wasmtime_wasi::IoImpl(t));
8080
let closure = type_annotate_wasi::<T, _>(|t| wasmtime_wasi::WasiImpl(wasmtime_wasi::IoImpl(t)));
81-
wasmtime_wasi::bindings::clocks::wall_clock::add_to_linker_get_host(l, closure)?;
82-
wasmtime_wasi::bindings::clocks::monotonic_clock::add_to_linker_get_host(l, closure)?;
83-
wasmtime_wasi::bindings::io::poll::add_to_linker_get_host(l, io_closure)?;
84-
wasmtime_wasi::bindings::io::error::add_to_linker_get_host(l, io_closure)?;
85-
wasmtime_wasi::bindings::io::streams::add_to_linker_get_host(l, io_closure)?;
86-
wasmtime_wasi::bindings::cli::stdin::add_to_linker_get_host(l, closure)?;
87-
wasmtime_wasi::bindings::cli::stdout::add_to_linker_get_host(l, closure)?;
88-
wasmtime_wasi::bindings::cli::stderr::add_to_linker_get_host(l, closure)?;
89-
wasmtime_wasi::bindings::random::random::add_to_linker_get_host(l, closure)?;
81+
wasmtime_wasi::p2::bindings::clocks::wall_clock::add_to_linker_get_host(l, closure)?;
82+
wasmtime_wasi::p2::bindings::clocks::monotonic_clock::add_to_linker_get_host(l, closure)?;
83+
wasmtime_wasi::p2::bindings::io::poll::add_to_linker_get_host(l, io_closure)?;
84+
wasmtime_wasi::p2::bindings::io::error::add_to_linker_get_host(l, io_closure)?;
85+
wasmtime_wasi::p2::bindings::io::streams::add_to_linker_get_host(l, io_closure)?;
86+
wasmtime_wasi::p2::bindings::cli::stdin::add_to_linker_get_host(l, closure)?;
87+
wasmtime_wasi::p2::bindings::cli::stdout::add_to_linker_get_host(l, closure)?;
88+
wasmtime_wasi::p2::bindings::cli::stderr::add_to_linker_get_host(l, closure)?;
89+
wasmtime_wasi::p2::bindings::random::random::add_to_linker_get_host(l, closure)?;
9090

9191
add_only_http_to_linker_async(l)
9292
}
@@ -156,15 +156,15 @@ where
156156
let io_closure = type_annotate_io::<T, _>(|t| wasmtime_wasi::IoImpl(t));
157157
let closure = type_annotate_wasi::<T, _>(|t| wasmtime_wasi::WasiImpl(wasmtime_wasi::IoImpl(t)));
158158

159-
wasmtime_wasi::bindings::clocks::wall_clock::add_to_linker_get_host(l, closure)?;
160-
wasmtime_wasi::bindings::clocks::monotonic_clock::add_to_linker_get_host(l, closure)?;
161-
wasmtime_wasi::bindings::sync::io::poll::add_to_linker_get_host(l, io_closure)?;
162-
wasmtime_wasi::bindings::sync::io::streams::add_to_linker_get_host(l, io_closure)?;
163-
wasmtime_wasi::bindings::io::error::add_to_linker_get_host(l, io_closure)?;
164-
wasmtime_wasi::bindings::cli::stdin::add_to_linker_get_host(l, closure)?;
165-
wasmtime_wasi::bindings::cli::stdout::add_to_linker_get_host(l, closure)?;
166-
wasmtime_wasi::bindings::cli::stderr::add_to_linker_get_host(l, closure)?;
167-
wasmtime_wasi::bindings::random::random::add_to_linker_get_host(l, closure)?;
159+
wasmtime_wasi::p2::bindings::clocks::wall_clock::add_to_linker_get_host(l, closure)?;
160+
wasmtime_wasi::p2::bindings::clocks::monotonic_clock::add_to_linker_get_host(l, closure)?;
161+
wasmtime_wasi::p2::bindings::sync::io::poll::add_to_linker_get_host(l, io_closure)?;
162+
wasmtime_wasi::p2::bindings::sync::io::streams::add_to_linker_get_host(l, io_closure)?;
163+
wasmtime_wasi::p2::bindings::io::error::add_to_linker_get_host(l, io_closure)?;
164+
wasmtime_wasi::p2::bindings::cli::stdin::add_to_linker_get_host(l, closure)?;
165+
wasmtime_wasi::p2::bindings::cli::stdout::add_to_linker_get_host(l, closure)?;
166+
wasmtime_wasi::p2::bindings::cli::stderr::add_to_linker_get_host(l, closure)?;
167+
wasmtime_wasi::p2::bindings::random::random::add_to_linker_get_host(l, closure)?;
168168

169169
add_only_http_to_linker_sync(l)?;
170170

crates/wasi-http/src/p2/types_impl.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use wasmtime_wasi::{
1919
IoView, Pollable, ResourceTableError,
2020
};
2121

22-
impl<T> crate::bindings::http::types::Host for WasiHttpImpl<T>
22+
impl<T> crate::p2::bindings::http::types::Host for WasiHttpImpl<T>
2323
where
2424
T: WasiHttpView,
2525
{
@@ -101,7 +101,7 @@ fn get_fields_mut<'a>(
101101
}
102102
}
103103

104-
impl<T> crate::bindings::http::types::HostFields for WasiHttpImpl<T>
104+
impl<T> crate::p2::bindings::http::types::HostFields for WasiHttpImpl<T>
105105
where
106106
T: WasiHttpView,
107107
{
@@ -291,7 +291,7 @@ where
291291
}
292292
}
293293

294-
impl<T> crate::bindings::http::types::HostIncomingRequest for WasiHttpImpl<T>
294+
impl<T> crate::p2::bindings::http::types::HostIncomingRequest for WasiHttpImpl<T>
295295
where
296296
T: WasiHttpView,
297297
{
@@ -365,7 +365,7 @@ where
365365
}
366366
}
367367

368-
impl<T> crate::bindings::http::types::HostOutgoingRequest for WasiHttpImpl<T>
368+
impl<T> crate::p2::bindings::http::types::HostOutgoingRequest for WasiHttpImpl<T>
369369
where
370370
T: WasiHttpView,
371371
{
@@ -557,7 +557,7 @@ where
557557
}
558558
}
559559

560-
impl<T> crate::bindings::http::types::HostResponseOutparam for WasiHttpImpl<T>
560+
impl<T> crate::p2::bindings::http::types::HostResponseOutparam for WasiHttpImpl<T>
561561
where
562562
T: WasiHttpView,
563563
{
@@ -583,7 +583,7 @@ where
583583
}
584584
}
585585

586-
impl<T> crate::bindings::http::types::HostIncomingResponse for WasiHttpImpl<T>
586+
impl<T> crate::p2::bindings::http::types::HostIncomingResponse for WasiHttpImpl<T>
587587
where
588588
T: WasiHttpView,
589589
{
@@ -647,7 +647,7 @@ where
647647
}
648648
}
649649

650-
impl<T> crate::bindings::http::types::HostFutureTrailers for WasiHttpImpl<T>
650+
impl<T> crate::p2::bindings::http::types::HostFutureTrailers for WasiHttpImpl<T>
651651
where
652652
T: WasiHttpView,
653653
{
@@ -697,7 +697,7 @@ where
697697
}
698698
}
699699

700-
impl<T> crate::bindings::http::types::HostIncomingBody for WasiHttpImpl<T>
700+
impl<T> crate::p2::bindings::http::types::HostIncomingBody for WasiHttpImpl<T>
701701
where
702702
T: WasiHttpView,
703703
{
@@ -731,7 +731,7 @@ where
731731
}
732732
}
733733

734-
impl<T> crate::bindings::http::types::HostOutgoingResponse for WasiHttpImpl<T>
734+
impl<T> crate::p2::bindings::http::types::HostOutgoingResponse for WasiHttpImpl<T>
735735
where
736736
T: WasiHttpView,
737737
{
@@ -826,7 +826,7 @@ where
826826
}
827827
}
828828

829-
impl<T> crate::bindings::http::types::HostFutureIncomingResponse for WasiHttpImpl<T>
829+
impl<T> crate::p2::bindings::http::types::HostFutureIncomingResponse for WasiHttpImpl<T>
830830
where
831831
T: WasiHttpView,
832832
{
@@ -888,7 +888,7 @@ where
888888
}
889889
}
890890

891-
impl<T> crate::bindings::http::types::HostOutgoingBody for WasiHttpImpl<T>
891+
impl<T> crate::p2::bindings::http::types::HostOutgoingBody for WasiHttpImpl<T>
892892
where
893893
T: WasiHttpView,
894894
{
@@ -928,7 +928,7 @@ where
928928
}
929929
}
930930

931-
impl<T> crate::bindings::http::types::HostRequestOptions for WasiHttpImpl<T>
931+
impl<T> crate::p2::bindings::http::types::HostRequestOptions for WasiHttpImpl<T>
932932
where
933933
T: WasiHttpView,
934934
{

crates/wasi-http/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ pub async fn default_send_request_handler(
375375
let (mut sender, worker) = if use_tls {
376376
#[cfg(any(target_arch = "riscv64", target_arch = "s390x"))]
377377
{
378-
return Err(crate::bindings::http::types::ErrorCode::InternalError(
378+
return Err(crate::p2::bindings::http::types::ErrorCode::InternalError(
379379
Some("unsupported architecture for SSL".to_string()),
380380
));
381381
}

crates/wasi-http/tests/all/async_.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::*;
22
use test_programs_artifacts::*;
3-
use wasmtime_wasi::bindings::Command;
3+
use wasmtime_wasi::p2::bindings::Command;
44

55
foreach_http!(assert_test_exists);
66

crates/wasi-http/tests/all/sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::*;
22
use test_programs_artifacts::*;
3-
use wasmtime_wasi::bindings::sync::Command;
3+
use wasmtime_wasi::p2::bindings::sync::Command;
44

55
foreach_http!(assert_test_exists);
66

crates/wasi-nn/tests/exec/wit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use anyhow::{anyhow, Result};
44
use std::path::Path;
55
use wasmtime::component::{Component, Linker, ResourceTable};
66
use wasmtime::{Config, Engine, Store};
7-
use wasmtime_wasi::bindings::sync::Command;
7+
use wasmtime_wasi::p2::bindings::sync::Command;
88
use wasmtime_wasi::{DirPerms, FilePerms, WasiCtx, WasiCtxBuilder};
99
use wasmtime_wasi_nn::wit::WasiNnView;
1010
use wasmtime_wasi_nn::{wit::WasiNnCtx, Backend, InMemoryRegistry};

crates/wasi/src/filesystem.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::bindings::filesystem::types;
1+
use crate::p2::bindings::filesystem::types;
22
use crate::runtime::{spawn_blocking, AbortOnDropJoinHandle};
33
use crate::{
44
HostInputStream, HostOutputStream, StreamError, StreamResult, Subscribe, TrappableError,

crates/wasi/src/ip_name_lookup.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use crate::bindings::sockets::ip_name_lookup::{Host, HostResolveAddressStream};
2-
use crate::bindings::sockets::network::{ErrorCode, IpAddress, Network};
31
use crate::host::network::util;
2+
use crate::p2::bindings::sockets::ip_name_lookup::{Host, HostResolveAddressStream};
3+
use crate::p2::bindings::sockets::network::{ErrorCode, IpAddress, Network};
44
use crate::poll::{subscribe, Pollable, Subscribe};
55
use crate::runtime::{spawn_blocking, AbortOnDropJoinHandle};
66
use crate::{IoView, SocketError, WasiImpl, WasiView};

crates/wasi/src/network.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::bindings::sockets::network::{ErrorCode, Ipv4Address, Ipv6Address};
1+
use crate::p2::bindings::sockets::network::{ErrorCode, Ipv4Address, Ipv6Address};
22
use crate::TrappableError;
33
use std::future::Future;
44
use std::net::SocketAddr;

crates/wasi/src/p2/bindings.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
//! ",
3838
//! path: "src/p2/wit",
3939
//! with: {
40-
//! "wasi": wasmtime_wasi::bindings,
40+
//! "wasi": wasmtime_wasi::p2::bindings,
4141
//! },
4242
//! async: true,
4343
//! });
@@ -76,7 +76,7 @@
7676
7777
/// Synchronous-generated bindings for WASI interfaces.
7878
///
79-
/// This is the same as the top-level [`bindings`](crate::bindings) module of
79+
/// This is the same as the top-level [`bindings`](crate::p2::bindings) module of
8080
/// this crate except that it's for synchronous calls.
8181
///
8282
/// # Examples
@@ -108,7 +108,7 @@
108108
/// ",
109109
/// path: "src/p2/wit",
110110
/// with: {
111-
/// "wasi": wasmtime_wasi::bindings::sync,
111+
/// "wasi": wasmtime_wasi::p2::bindings::sync,
112112
/// },
113113
/// // This is required for bindings using `wasmtime-wasi` and it otherwise
114114
/// // isn't the default for non-async bindings.
@@ -161,12 +161,12 @@ pub mod sync {
161161
with: {
162162
// These interfaces come from the outer module, as it's
163163
// sync/async agnostic.
164-
"wasi:clocks": crate::bindings::clocks,
165-
"wasi:random": crate::bindings::random,
166-
"wasi:cli": crate::bindings::cli,
167-
"wasi:io/error": crate::bindings::io::error,
168-
"wasi:filesystem/preopens": crate::bindings::filesystem::preopens,
169-
"wasi:sockets/network": crate::bindings::sockets::network,
164+
"wasi:clocks": crate::p2::bindings::clocks,
165+
"wasi:random": crate::p2::bindings::random,
166+
"wasi:cli": crate::p2::bindings::cli,
167+
"wasi:io/error": crate::p2::bindings::io::error,
168+
"wasi:filesystem/preopens": crate::p2::bindings::filesystem::preopens,
169+
"wasi:sockets/network": crate::p2::bindings::sockets::network,
170170

171171
// Configure the resource types of the bound interfaces here
172172
// to be the same as the async versions of the resources, that
@@ -206,7 +206,7 @@ pub mod sync {
206206
/// use wasmtime::{Engine, Result, Store, Config};
207207
/// use wasmtime::component::{ResourceTable, Linker, Component};
208208
/// use wasmtime_wasi::{IoView, WasiCtx, WasiView, WasiCtxBuilder};
209-
/// use wasmtime_wasi::bindings::sync::Command;
209+
/// use wasmtime_wasi::p2::bindings::sync::Command;
210210
///
211211
/// // This example is an example shim of executing a component based on the
212212
/// // command line arguments provided to this program.
@@ -271,7 +271,7 @@ pub mod sync {
271271
/// use wasmtime::{Engine, Result, Store, Config};
272272
/// use wasmtime::component::{ResourceTable, Linker, Component};
273273
/// use wasmtime_wasi::{IoView, WasiCtx, WasiView, WasiCtxBuilder};
274-
/// use wasmtime_wasi::bindings::sync::CommandPre;
274+
/// use wasmtime_wasi::p2::bindings::sync::CommandPre;
275275
///
276276
/// // This example is an example shim of executing a component based on the
277277
/// // command line arguments provided to this program.
@@ -448,7 +448,7 @@ pub use self::async_io::LinkOptions;
448448
/// use wasmtime::{Engine, Result, Store, Config};
449449
/// use wasmtime::component::{ResourceTable, Linker, Component};
450450
/// use wasmtime_wasi::{IoView, WasiCtx, WasiView, WasiCtxBuilder};
451-
/// use wasmtime_wasi::bindings::Command;
451+
/// use wasmtime_wasi::p2::bindings::Command;
452452
///
453453
/// // This example is an example shim of executing a component based on the
454454
/// // command line arguments provided to this program.
@@ -516,7 +516,7 @@ pub use self::async_io::Command;
516516
/// use wasmtime::{Engine, Result, Store, Config};
517517
/// use wasmtime::component::{ResourceTable, Linker, Component};
518518
/// use wasmtime_wasi::{IoView, WasiCtx, WasiView, WasiCtxBuilder};
519-
/// use wasmtime_wasi::bindings::CommandPre;
519+
/// use wasmtime_wasi::p2::bindings::CommandPre;
520520
///
521521
/// // This example is an example shim of executing a component based on the
522522
/// // command line arguments provided to this program.

crates/wasi/src/p2/host/clocks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![allow(unused_variables)]
22

3-
use crate::bindings::{
3+
use crate::p2::bindings::{
44
clocks::monotonic_clock::{self, Duration as WasiDuration, Instant},
55
clocks::wall_clock::{self, Datetime},
66
};

crates/wasi/src/p2/host/env.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::bindings::cli::environment;
1+
use crate::p2::bindings::cli::environment;
22
use crate::{WasiImpl, WasiView};
33

44
impl<T> environment::Host for WasiImpl<T>

crates/wasi/src/p2/host/filesystem.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
use crate::bindings::clocks::wall_clock;
2-
use crate::bindings::filesystem::preopens;
3-
use crate::bindings::filesystem::types::{
4-
self, ErrorCode, HostDescriptor, HostDirectoryEntryStream,
5-
};
6-
use crate::bindings::io::streams::{InputStream, OutputStream};
71
use crate::filesystem::{
82
Descriptor, Dir, File, FileInputStream, FileOutputStream, OpenMode, ReaddirIterator,
93
};
4+
use crate::p2::bindings::clocks::wall_clock;
5+
use crate::p2::bindings::filesystem::preopens;
6+
use crate::p2::bindings::filesystem::types::{
7+
self, ErrorCode, HostDescriptor, HostDirectoryEntryStream,
8+
};
9+
use crate::p2::bindings::io::streams::{InputStream, OutputStream};
1010
use crate::{DirPerms, FilePerms, FsError, FsResult, IoView, WasiImpl, WasiView};
1111
use anyhow::Context;
1212
use wasmtime::component::Resource;

crates/wasi/src/p2/host/filesystem/sync.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use crate::bindings::filesystem::types as async_filesystem;
2-
use crate::bindings::sync::filesystem::types as sync_filesystem;
3-
use crate::bindings::sync::io::streams;
1+
use crate::p2::bindings::filesystem::types as async_filesystem;
2+
use crate::p2::bindings::sync::filesystem::types as sync_filesystem;
3+
use crate::p2::bindings::sync::io::streams;
44
use crate::runtime::in_tokio;
55
use crate::{FsError, FsResult, WasiImpl, WasiView};
66
use wasmtime::component::Resource;

crates/wasi/src/p2/host/instance_network.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::bindings::sockets::instance_network;
21
use crate::network::Network;
2+
use crate::p2::bindings::sockets::instance_network;
33
use crate::{IoView, WasiImpl, WasiView};
44
use wasmtime::component::Resource;
55

crates/wasi/src/p2/host/network.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use crate::bindings::sockets::network::{
1+
use crate::network::{from_ipv4_addr, from_ipv6_addr, to_ipv4_addr, to_ipv6_addr};
2+
use crate::p2::bindings::sockets::network::{
23
self, ErrorCode, IpAddress, IpAddressFamily, IpSocketAddress, Ipv4SocketAddress,
34
Ipv6SocketAddress,
45
};
5-
use crate::network::{from_ipv4_addr, from_ipv6_addr, to_ipv4_addr, to_ipv6_addr};
66
use crate::{IoView, SocketError, WasiImpl, WasiView};
77
use anyhow::Error;
88
use rustix::io::Errno;
@@ -28,7 +28,7 @@ where
2828
}
2929
}
3030

31-
impl<T> crate::bindings::sockets::network::HostNetwork for WasiImpl<T>
31+
impl<T> crate::p2::bindings::sockets::network::HostNetwork for WasiImpl<T>
3232
where
3333
T: WasiView,
3434
{

crates/wasi/src/p2/host/random.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::bindings::random::{insecure, insecure_seed, random};
1+
use crate::p2::bindings::random::{insecure, insecure_seed, random};
22
use crate::{WasiImpl, WasiView};
33
use cap_rand::{distributions::Standard, Rng};
44

0 commit comments

Comments
 (0)