Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Use `.` instead of `/` for interface members. (#11947)

Dan Gohman8c03849b8f0c
diff --git a/crates/component-macro/tests/codegen.rs b/crates/component-macro/tests/codegen.rs
index b128e3a346..87427d8d61 100644
--- a/crates/component-macro/tests/codegen.rs
+++ b/crates/component-macro/tests/codegen.rs
@@ -70,10 +70,10 @@ mod with_key_and_resources {
with: {
"a": MyA,
"b": MyA,
- "foo/a": MyA,
- "foo/b": MyA,
- "demo:pkg/bar/a": MyA,
- "demo:pkg/bar/b": MyA,
+ "foo.a": MyA,
+ "foo.b": MyA,
+ "demo:pkg/bar.a": MyA,
+ "demo:pkg/bar.b": MyA,
},
});
@@ -144,7 +144,7 @@ mod trappable_errors_with_versioned_and_unversioned_packages {
",
path: "tests/codegen/unversioned-foo.wit",
trappable_error_type: {
- "foo:foo/[email protected]/error" => MyX,
+ "foo:foo/[email protected]" => MyX,
},
});
@@ -184,8 +184,8 @@ mod trappable_errors {
}
",
trappable_error_type: {
- "demo:pkg/a/b" => MyX,
- "demo:pkg/c/b" => MyX,
+ "demo:pkg/a.b" => MyX,
+ "demo:pkg/c.b" => MyX,
},
});
@@ -448,10 +448,10 @@ mod trappable_imports {
",
imports: {
"foo": trappable | exact,
- "i/foo": trappable,
- "foo:foo/a/foo": trappable,
+ "i.foo": trappable,
+ "foo:foo/a.foo": trappable,
},
- with: { "foo:foo/a/r": R },
+ with: { "foo:foo/a.r": R },
});
struct X;
@@ -511,11 +511,11 @@ mod trappable_imports {
}
",
imports: {
- "foo:foo/a/[constructor]r": trappable,
- "foo:foo/a/[method]r.foo": trappable,
- "foo:foo/a/[static]r.bar": trappable,
+ "foo:foo/a.[constructor]r": trappable,
+ "foo:foo/a.[method]r.foo": trappable,
+ "foo:foo/a.[static]r.bar": trappable,
},
- with: { "foo:foo/a/r": R },
+ with: { "foo:foo/a.r": R },
});
struct X;
@@ -610,7 +610,7 @@ mod with_and_mixing_async {
}
",
imports: {
- "my:inline/bar/bar": async,
+ "my:inline/bar.bar": async,
},
});
}
@@ -680,7 +680,7 @@ mod trappable_error_type_and_versions {
world foo {}
",
trappable_error_type: {
- "my:inline/i/e" => super::MyError,
+ "my:inline/i.e" => super::MyError,
},
});
}
@@ -694,7 +694,7 @@ mod trappable_error_type_and_versions {
world foo {}
",
trappable_error_type: {
- "my:inline/i/e" => super::MyError,
+ "my:inline/i.e" => super::MyError,
},
});
}
@@ -708,7 +708,7 @@ mod trappable_error_type_and_versions {
world foo {}
",
trappable_error_type: {
- "my:inline/[email protected]/e" => super::MyError,
+ "my:inline/[email protected]" => super::MyError,
},
});
}
diff --git a/crates/misc/component-async-tests/src/borrowing_host.rs b/crates/misc/component-async-tests/src/borrowing_host.rs
index 0d9f752be4..9029263478 100644
--- a/crates/misc/component-async-tests/src/borrowing_host.rs
+++ b/crates/misc/component-async-tests/src/borrowing_host.rs
@@ -9,12 +9,12 @@ pub mod bindings {
world: "borrowing-host",
imports: { default: trappable },
with: {
- "local:local/borrowing-types/x": super::MyX,
+ "local:local/borrowing-types.x": super::MyX,
}
});
}
-/// Used as the borrowing type (`local:local/borrowing-types/x`)
+/// Used as the borrowing type (`local:local/borrowing-types.x`)
pub struct MyX;
impl bindings::local::local::borrowing_types::HostX for &mut Ctx {
diff --git a/crates/misc/component-async-tests/src/resource_stream.rs b/crates/misc/component-async-tests/src/resource_stream.rs
index a47e721ed6..eface6d49b 100644
--- a/crates/misc/component-async-tests/src/resource_stream.rs
+++ b/crates/misc/component-async-tests/src/resource_stream.rs
@@ -10,10 +10,10 @@ pub mod bindings {
path: "wit",
world: "read-resource-stream",
with: {
- "local:local/resource-stream/x": super::ResourceStreamX,
+ "local:local/resource-stream.x": super::ResourceStreamX,
},
imports: {
- "local:local/resource-stream/foo": async | store | trappable,
+ "local:local/resource-stream.foo": async | store | trappable,
default: trappable,
},
});
diff --git a/crates/wasi-http/src/bindings.rs b/crates/wasi-http/src/bindings.rs
index bb9bb1483f..bec9402a87 100644
--- a/crates/wasi-http/src/bindings.rs
+++ b/crates/wasi-http/src/bindings.rs
@@ -17,20 +17,20 @@ mod generated {
// Configure all WIT http resources to be defined types in this
// crate to use the `ResourceTable` helper methods.
- "wasi:http/types/outgoing-body": body::HostOutgoingBody,
- "wasi:http/types/future-incoming-response": types::HostFutureIncomingResponse,
- "wasi:http/types/outgoing-response": types::HostOutgoingResponse,
- "wasi:http/types/future-trailers": body::HostFutureTrailers,
- "wasi:http/types/incoming-body": body::HostIncomingBody,
- "wasi:http/types/incoming-response": types::HostIncomingResponse,
- "wasi:http/types/response-outparam": types::HostResponseOutparam,
- "wasi:http/types/outgoing-request": types::HostOutgoingRequest,
- "wasi:http/types/incoming-request": types::HostIncomingRequest,
- "wasi:http/types/fields": types::HostFields,
- "wasi:http/types/request-options": types::HostRequestOptions,
+ "wasi:http/types.outgoing-body": body::HostOutgoingBody,
+ "wasi:http/types.future-incoming-response": types::HostFutureIncomingResponse,
+ "wasi:http/types.outgoing-response": types::HostOutgoingResponse,
+ "wasi:http/types.future-trailers": body::HostFutureTrailers,
+ "wasi:http/types.incoming-body": body::HostIncomingBody,
+ "wasi:http/types.incoming-response": types::HostIncomingResponse,
+ "wasi:http/types.response-outparam": types::HostResponseOutparam,
+ "wasi:http/types.outgoing-request": types::HostOutgoingRequest,
+ "wasi:http/types.incoming-request": types::HostIncomingRequest,
+ "wasi:http/types.fields": types::HostFields,
+ "wasi:http/types.request-options": types::HostRequestOptions,
},
trappable_error_type: {
- "wasi:http/types/error-code" => crate::HttpError,
+ "wasi:http/types.error-code" => crate::HttpError,
},
});
}
diff --git a/crates/wasi-http/src/body.rs b/crates/wasi-http/src/body.rs
index 4f2877fa49..77aa307520 100644
--- a/crates/wasi-http/src/body.rs
+++ b/crates/wasi-http/src/body.rs
@@ -20,7 +20,7 @@ pub type HyperIncomingBody = BoxBody<Bytes, types::ErrorCode>;
/// Common type for outgoing bodies.
pub type HyperOutgoingBody = BoxBody<Bytes, types::ErrorCode>;
-/// The concrete type behind a `was:http/types/incoming-body` resource.
+/// The concrete type behind a `was:http/types.incoming-body` resource.
#[derive(Debug)]
pub struct HostIncomingBody {
body: IncomingBodyState,
@@ -158,8 +158,8 @@ enum StreamEnd {
Trailers(Option<FieldMap>),
}
-/// The concrete type behind the `wasi:io/streams/input-stream` resource returned
-/// by `wasi:http/types/incoming-body`'s `stream` method.
+/// The concrete type behind the `wasi:io/streams.input-stream` resource returned
+/// by `wasi:http/types.incoming-body`'s `stream` method.
#[derive(Debug)]
pub struct HostIncomingBodyStream {
state: IncomingBodyStreamState,
@@ -296,7 +296,7 @@ impl Drop for HostIncomingBodyStream {
}
}
-/// The concrete type behind a `wasi:http/types/future-trailers` resource.
+/// The concrete type behind a `wasi:http/types.future-trailers` resource.
#[derive(Debug)]
pub enum HostFutureTrailers {
/// Trailers aren't here yet.
@@ -410,7 +410,7 @@ impl WrittenState {
}
}
-/// The concrete type behind a `wasi:http/types/outgoing-body` resource.
+/// The concrete type behind a `wasi:http/types.outgoing-body` resource.
pub struct HostOutgoingBody {
/// The output stream that the body is written to.
body_output_stream: Option<Box<dyn OutputStream>>,
diff --git a/crates/wasi-http/src/p3/bindings.rs b/crates/wasi-http/src/p3/bindings.rs
index ba9c497a8e..4ac74d9402 100644
--- a/crates/wasi-http/src/p3/bindings.rs
+++ b/crates/wasi-http/src/p3/bindings.rs
@@ -6,26 +6,26 @@ mod generated {
path: "src/p3/wit",
world: "wasi:http/proxy",
imports: {
- "wasi:http/handler/[async]handle": async | store | trappable | tracing,
- "wasi:http/types/[drop]request": store | trappable | tracing,
- "wasi:http/types/[drop]response": store | trappable | tracing,
- "wasi:http/types/[static]request.consume-body": async | store | trappable | tracing,
- "wasi:http/types/[static]request.new": async | store | trappable | tracing,
- "wasi:http/types/[static]response.consume-body": async | store | trappable | tracing,
- "wasi:http/types/[static]response.new": async | store | trappable | tracing,
+ "wasi:http/handler.[async]handle": async | store | trappable | tracing,
+ "wasi:http/types.[drop]request": store | trappable | tracing,
+ "wasi:http/types.[drop]response": store | trappable | tracing,
+ "wasi:http/types.[static]request.consume-body": async | store | trappable | tracing,
+ "wasi:http/types.[static]request.new": async | store | trappable | tracing,
+ "wasi:http/types.[static]response.consume-body": async | store | trappable | tracing,
+ "wasi:http/types.[static]response.new": async | store | trappable | tracing,
default: trappable | tracing,
},
exports: { default: async | store | task_exit },
with: {
- "wasi:http/types/fields": with::Fields,
- "wasi:http/types/request": crate::p3::Request,
- "wasi:http/types/request-options": with::RequestOptions,
- "wasi:http/types/response": crate::p3::Response,
+ "wasi:http/types.fields": with::Fields,
+ "wasi:http/types.request": crate::p3::Request,
+ "wasi:http/types.request-options": with::RequestOptions,
+ "wasi:http/types.response": crate::p3::Response,
},
trappable_error_type: {
- "wasi:http/types/error-code" => crate::p3::HttpError,
- "wasi:http/types/header-error" => crate::p3::HeaderError,
- "wasi:http/types/request-options-error" => crate::p3::RequestOptionsError,
+ "wasi:http/types.error-code" => crate::p3::HttpError,
+ "wasi:http/types.header-error" => crate::p3::HeaderError,
+ "wasi:http/types.request-options-error" => crate::p3::RequestOptionsError,
},
});
diff --git a/crates/wasi-http/src/p3/body.rs b/crates/wasi-http/src/p3/body.rs
index 2dec765c45..54e93d61f6 100644
--- a/crates/wasi-http/src/p3/body.rs
+++ b/crates/wasi-http/src/p3/body.rs
@@ -20,7 +20,7 @@ use wasmtime::component::{
};
use wasmtime::{AsContextMut, StoreContextMut};
-/// The concrete type behind a `wasi:http/types/body` resource.
+/// The concrete type behind a `wasi:http/types.body` resource.
pub(crate) enum Body {
/// Body constructed by the guest
Guest {
diff --git a/crates/wasi-http/src/p3/request.rs b/crates/wasi-http/src/p3/request.rs
index 89d1ceb81a..4f921258f1 100644
--- a/crates/wasi-http/src/p3/request.rs
+++ b/crates/wasi-http/src/p3/request.rs
@@ -9,7 +9,7 @@ use http_body_util::combinators::UnsyncBoxBody;
use std::sync::Arc;
use tokio::sync::oneshot;
-/// The concrete type behind a `wasi:http/types/request-options` resource.
+/// The concrete type behind a `wasi:http/types.request-options` resource.
#[derive(Copy, Clone, Debug, Default)]
pub struct RequestOptions {
/// How long to wait for a connection to be established.
@@ -20,7 +20,7 @@ pub struct RequestOptions {
pub between_bytes_timeout: Option<Duration>,
}
-/// The concrete type behind a `wasi:http/types/request` resource.
+/// The concrete type behind a `wasi:http/types.request` resource.
pub struct Request {
/// The method of the request.
pub method: Method,
diff --git a/crates/wasi-http/src/p3/response.rs b/crates/wasi-http/src/p3/response.rs
index 2585cc3f3a..d1827366cf 100644
--- a/crates/wasi-http/src/p3/response.rs
+++ b/crates/wasi-http/src/p3/response.rs
@@ -10,7 +10,7 @@ use http_body_util::combinators::UnsyncBoxBody;
use std::sync::Arc;
use wasmtime::AsContextMut;
-/// The concrete type behind a `wasi:http/types/response` resource.
+/// The concrete type behind a `wasi:http/types.response` resource.
pub struct Response {
/// The status of the response.
pub status: StatusCode,
diff --git a/crates/wasi-http/src/types.rs b/crates/wasi-http/src/types.rs
index 3a0aa0235b..22c3feeda2 100644
--- a/crates/wasi-http/src/types.rs
+++ b/crates/wasi-http/src/types.rs
@@ -530,7 +530,7 @@ impl TryInto<http::Method> for types::Method {
}
}
-/// The concrete type behind a `wasi:http/types/incoming-request` resource.
+/// The concrete type behind a `wasi:http/types.incoming-request` resource.
#[derive(Debug)]
pub struct HostIncomingRequest {
pub(crate) parts: http::request::Parts,
@@ -566,14 +566,14 @@ impl HostIncomingRequest {
}
}
-/// The concrete type behind a `wasi:http/types/response-outparam` resource.
+/// The concrete type behind a `wasi:http/types.response-outparam` resource.
pub struct HostResponseOutparam {
/// The sender for sending a response.
pub result:
tokio::sync::oneshot::Sender<Result<hyper::Response<HyperOutgoingBody>, types::ErrorCode>>,
}
-/// The concrete type behind a `wasi:http/types/outgoing-response` resource.
+/// The concrete type behind a `wasi:http/types.outgoing-response` resource.
pub struct HostOutgoingResponse {
/// The status of the response.
pub status: http::StatusCode,
@@ -606,7 +606,7 @@ impl TryFrom<HostOutgoingResponse> for hyper::Response<HyperOutgoingBody> {
}
}
-/// The concrete type behind a `wasi:http/types/outgoing-request` resource.
+/// The concrete type behind a `wasi:http/types.outgoing-request` resource.
#[derive(Debug)]
pub struct HostOutgoingRequest {
/// The method of the request.
@@ -623,7 +623,7 @@ pub struct HostOutgoingRequest {
pub body: Option<HyperOutgoingBody>,
}
-/// The concrete type behind a `wasi:http/types/request-options` resource.
+/// The concrete type behind a `wasi:http/types.request-options` resource.
#[derive(Debug, Default)]
pub struct HostRequestOptions {
/// How long to wait for a connection to be established.
@@ -634,7 +634,7 @@ pub struct HostRequestOptions {
pub between_bytes_timeout: Option<std::time::Duration>,
}
-/// The concrete type behind a `wasi:http/types/incoming-response` resource.
+/// The concrete type behind a `wasi:http/types.incoming-response` resource.
#[derive(Debug)]
pub struct HostIncomingResponse {
/// The response status
@@ -645,7 +645,7 @@ pub struct HostIncomingResponse {
pub body: Option<HostIncomingBody>,
}
-/// The concrete type behind a `wasi:http/types/fields` resource.
+/// The concrete type behind a `wasi:http/types.fields` resource.
#[derive(Debug)]
pub enum HostFields {
/// A reference to the fields of a parent entry.
@@ -685,7 +685,7 @@ pub struct IncomingResponse {
pub between_bytes_timeout: std::time::Duration,
}
-/// The concrete type behind a `wasi:http/types/future-incoming-response` resource.
+/// The concrete type behind a `wasi:http/types.future-incoming-response` resource.
#[derive(Debug)]
pub enum HostFutureIncomingResponse {
/// A pending response
diff --git a/crates/wasi-io/src/bindings.rs b/crates/wasi-io/src/bindings.rs
index 74ab41ab92..ad39f6e247 100644
--- a/crates/wasi-io/src/bindings.rs
+++ b/crates/wasi-io/src/bindings.rs
@@ -1,26 +1,26 @@
wasmtime::component::bindgen!({
path: "wit",
with: {
- "wasi:io/poll/pollable": crate::poll::DynPollable,
- "wasi:io/streams/input-stream": crate::streams::DynInputStream,
- "wasi:io/streams/output-stream": crate::streams::DynOutputStream,
- "wasi:io/error/error": crate::streams::Error,
+ "wasi:io/poll.pollable": crate::poll::DynPollable,
+ "wasi:io/streams.input-stream": crate::streams::DynInputStream,
+ "wasi:io/streams.output-stream": crate::streams::DynOutputStream,
+ "wasi:io/error.error": crate::streams::Error,
},
imports: {
- "wasi:io/poll/poll": async | trappable,
- "wasi:io/poll/[method]pollable.block": async | trappable,
- "wasi:io/poll/[method]pollable.ready": async | trappable,
- "wasi:io/streams/[method]input-stream.blocking-read": async | trappable,
- "wasi:io/streams/[method]input-stream.blocking-skip": async | trappable,
- "wasi:io/streams/[drop]input-stream": async | trappable,
- "wasi:io/streams/[method]output-stream.blocking-splice": async | trappable,
- "wasi:io/streams/[method]output-stream.blocking-flush": async | trappable,
- "wasi:io/streams/[method]output-stream.blocking-write-and-flush": async | trappable,
- "wasi:io/streams/[method]output-stream.blocking-write-zeroes-and-flush": async | trappable,
- "wasi:io/streams/[drop]output-stream": async | trappable,
+ "wasi:io/poll.poll": async | trappable,
+ "wasi:io/poll.[method]pollable.block": async | trappable,
+ "wasi:io/poll.[method]pollable.ready": async | trappable,
+ "wasi:io/streams.[method]input-stream.blocking-read": async | trappable,
+ "wasi:io/streams.[method]input-stream.blocking-skip": async | trappable,
+ "wasi:io/streams.[drop]input-stream": async | trappable,
+ "wasi:io/streams.[method]output-stream.blocking-splice": async | trappable,
+ "wasi:io/streams.[method]output-stream.blocking-flush": async | trappable,
+ "wasi:io/streams.[method]output-stream.blocking-write-and-flush": async | trappable,
+ "wasi:io/streams.[method]output-stream.blocking-write-zeroes-and-flush": async | trappable,
+ "wasi:io/streams.[drop]output-stream": async | trappable,
default: trappable,
},
trappable_error_type: {
- "wasi:io/streams/stream-error" => crate::streams::StreamError,
+ "wasi:io/streams.stream-error" => crate::streams::StreamError,
}
});
diff --git a/crates/wasi-io/src/poll.rs b/crates/wasi-io/src/poll.rs
index ed10025ba2..1173ec2bb2 100644
--- a/crates/wasi-io/src/poll.rs
+++ b/crates/wasi-io/src/poll.rs
@@ -80,7 +80,7 @@ pub trait Pollable: Send + 'static {
async fn ready(&mut self);
}
-/// Creates a `wasi:io/poll/pollable` resource which is subscribed to the provided
+/// Creates a `wasi:io/poll.pollable` resource which is subscribed to the provided
/// `resource`.
///
/// If `resource` is an owned resource then it will be deleted when the returned
diff --git a/crates/wasi-keyvalue/src/lib.rs b/crates/wasi-keyvalue/src/lib.rs
index 4e5972359e..9e4e95655d 100644
--- a/crates/wasi-keyvalue/src/lib.rs
+++ b/crates/wasi-keyvalue/src/lib.rs
@@ -72,10 +72,10 @@ mod generated {
world: "wasi:keyvalue/imports",
imports: { default: trappable },
with: {
- "wasi:keyvalue/store/bucket": crate::Bucket,
+ "wasi:keyvalue/store.bucket": crate::Bucket,
},
trappable_error_type: {
- "wasi:keyvalue/store/error" => crate::Error,
+ "wasi:keyvalue/store.error" => crate::Error,
},
});
}
diff --git a/crates/wasi-nn/src/wit.rs b/crates/wasi-nn/src/wit.rs
index 48703e3eb4..65c32fb1d8 100644
--- a/crates/wasi-nn/src/wit.rs
+++ b/crates/wasi-nn/src/wit.rs
@@ -121,14 +121,14 @@ pub(crate) mod generated_ {
with: {
// Configure all WIT http resources to be defined types in this
// crate to use the `ResourceTable` helper methods.
- "wasi:nn/graph/graph": crate::Graph,
- "wasi:nn/tensor/tensor": crate::Tensor,
- "wasi:nn/inference/graph-execution-context": crate::ExecutionContext,
- "wasi:nn/errors/error": super::Error,
+ "wasi:nn/graph.graph": crate::Graph,
+ "wasi:nn/tensor.tensor": crate::Tensor,
+ "wasi:nn/inference.graph-execution-context": crate::ExecutionContext,
+ "wasi:nn/errors.error": super::Error,
},
imports: { default: trappable },
trappable_error_type: {
- "wasi:nn/errors/error" => super::Error,
+ "wasi:nn/errors.error" => super::Error,
},
});
}
diff --git a/crates/wasi-tls/src/bindings.rs b/crates/wasi-tls/src/bindings.rs
index 03f8e72caf..e6de19e967 100644
--- a/crates/wasi-tls/src/bindings.rs
+++ b/crates/wasi-tls/src/bindings.rs
@@ -7,9 +7,9 @@ mod generated {
world: "wasi:tls/imports",
with: {
"wasi:io": wasmtime_wasi::p2::bindings::io,
- "wasi:tls/types/client-connection": crate::HostClientConnection,
- "wasi:tls/types/client-handshake": crate::HostClientHandshake,
- "wasi:tls/types/future-client-streams": crate::HostFutureClientStreams,
+ "wasi:tls/types.client-connection": crate::HostClientConnection,
+ "wasi:tls/types.client-handshake": crate::HostClientHandshake,
+ "wasi:tls/types.future-client-streams": crate::HostFutureClientStreams,
},
imports: { default: trappable },
require_store_data_send: true,
diff --git a/crates/wasi/src/p2/bindings.rs b/crates/wasi/src/p2/bindings.rs
index 5fb4e0d266..e60c7818f1 100644
--- a/crates/wasi/src/p2/bindings.rs
+++ b/crates/wasi/src/p2/bindings.rs
@@ -151,9 +151,9 @@ pub mod sync {
path: "src/p2/wit",
world: "wasi:cli/command",
trappable_error_type: {
- "wasi:io/streams/stream-error" => StreamError,
- "wasi:filesystem/types/error-code" => FsError,
- "wasi:sockets/network/error-code" => SocketError,
+ "wasi:io/streams.stream-error" => StreamError,
+ "wasi:filesystem/types.error-code" => FsError,
+ "wasi:sockets/network.error-code" => SocketError,
},
imports: { default: tracing | trappable },
with: {
@@ -168,20 +168,20 @@ pub mod sync {
// Configure the resource types of the bound interfaces here
// to be the same as the async versions of the resources, that
// way everything has the same type.
- "wasi:filesystem/types/descriptor": crate::filesystem::Descriptor,
- "wasi:filesystem/types/directory-entry-stream": super::super::filesystem::types::DirectoryEntryStream,
- "wasi:sockets/tcp/tcp-socket": super::super::sockets::tcp::TcpSocket,
- "wasi:sockets/udp/incoming-datagram-stream": super::super::sockets::udp::IncomingDatagramStream,
- "wasi:sockets/udp/outgoing-datagram-stream": super::super::sockets::udp::OutgoingDatagramStream,
- "wasi:sockets/udp/udp-socket": crate::sockets::UdpSocket,
+ "wasi:filesystem/types.descriptor": crate::filesystem::Descriptor,
+ "wasi:filesystem/types.directory-entry-stream": super::super::filesystem::types::DirectoryEntryStream,
+ "wasi:sockets/tcp.tcp-socket": super::super::sockets::tcp::TcpSocket,
+ "wasi:sockets/udp.incoming-datagram-stream": super::super::sockets::udp::IncomingDatagramStream,
+ "wasi:sockets/udp.outgoing-datagram-stream": super::super::sockets::udp::OutgoingDatagramStream,
+ "wasi:sockets/udp.udp-socket": crate::sockets::UdpSocket,
// Error host trait from wasmtime-wasi-io is synchronous, so we can alias it
"wasi:io/error": wasmtime_wasi_io::bindings::wasi::io::error,
// Configure the resource types from wasmtime-wasi-io, though
// this bindgen will make a new synchronous Host traits
- "wasi:io/poll/pollable": wasmtime_wasi_io::poll::DynPollable,
- "wasi:io/streams/input-stream": wasmtime_wasi_io::streams::DynInputStream,
- "wasi:io/streams/output-stream": wasmtime_wasi_io::streams::DynOutputStream,
+ "wasi:io/poll.pollable": wasmtime_wasi_io::poll::DynPollable,
+ "wasi:io/streams.input-stream": wasmtime_wasi_io::streams::DynInputStream,
+ "wasi:io/streams.output-stream": wasmtime_wasi_io::streams::DynOutputStream,
},
require_store_data_send: true,
@@ -344,43 +344,43 @@ mod async_io {
// Note that at this time `only_imports` works on function names
// which in theory can be shared across interfaces, so this may
// need fancier syntax in the future.
- "wasi:filesystem/types/[method]descriptor.advise": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.create-directory-at": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.get-flags": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.get-type": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.is-same-object": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.link-at": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.metadata-hash": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.metadata-hash-at": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.open-at": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.read": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.read-directory": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.readlink-at": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.remove-directory-at": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.rename-at": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.set-size": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.set-times": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.set-times-at": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.stat": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.stat-at": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.symlink-at": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.sync": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.sync-data": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.unlink-file-at": async | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.write": async | tracing | trappable,
- "wasi:filesystem/types/[method]directory-entry-stream.read-directory-entry": async | tracing | trappable,
- "wasi:sockets/tcp/[method]tcp-socket.start-bind": async | tracing | trappable,
- "wasi:sockets/tcp/[method]tcp-socket.start-connect": async | tracing | trappable,
- "wasi:sockets/udp/[method]udp-socket.start-bind": async | tracing | trappable,
- "wasi:sockets/udp/[method]udp-socket.stream": async | tracing | trappable,
- "wasi:sockets/udp/[method]outgoing-datagram-stream.send": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.advise": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.create-directory-at": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.get-flags": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.get-type": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.is-same-object": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.link-at": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.metadata-hash": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.metadata-hash-at": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.open-at": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.read": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.read-directory": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.readlink-at": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.remove-directory-at": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.rename-at": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.set-size": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.set-times": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.set-times-at": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.stat": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.stat-at": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.symlink-at": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.sync": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.sync-data": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.unlink-file-at": async | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.write": async | tracing | trappable,
+ "wasi:filesystem/types.[method]directory-entry-stream.read-directory-entry": async | tracing | trappable,
+ "wasi:sockets/tcp.[method]tcp-socket.start-bind": async | tracing | trappable,
+ "wasi:sockets/tcp.[method]tcp-socket.start-connect": async | tracing | trappable,
+ "wasi:sockets/udp.[method]udp-socket.start-bind": async | tracing | trappable,
+ "wasi:sockets/udp.[method]udp-socket.stream": async | tracing | trappable,
+ "wasi:sockets/udp.[method]outgoing-datagram-stream.send": async | tracing | trappable,
default: tracing | trappable,
},
exports: { default: async },
trappable_error_type: {
- "wasi:io/streams/stream-error" => wasmtime_wasi_io::streams::StreamError,
- "wasi:filesystem/types/error-code" => crate::p2::FsError,
- "wasi:sockets/network/error-code" => crate::p2::SocketError,
+ "wasi:io/streams.stream-error" => wasmtime_wasi_io::streams::StreamError,
+ "wasi:filesystem/types.error-code" => crate::p2::FsError,
+ "wasi:sockets/network.error-code" => crate::p2::SocketError,
},
with: {
// All interfaces in the wasi:io package should be aliased to
@@ -392,16 +392,16 @@ mod async_io {
// Configure all other resources to be concrete types defined in
// this crate
- "wasi:sockets/network/network": crate::p2::network::Network,
- "wasi:sockets/tcp/tcp-socket": crate::sockets::TcpSocket,
- "wasi:sockets/udp/udp-socket": crate::sockets::UdpSocket,
- "wasi:sockets/udp/incoming-datagram-stream": crate::p2::udp::IncomingDatagramStream,
- "wasi:sockets/udp/outgoing-datagram-stream": crate::p2::udp::OutgoingDatagramStream,
- "wasi:sockets/ip-name-lookup/resolve-address-stream": crate::p2::ip_name_lookup::ResolveAddressStream,
- "wasi:filesystem/types/directory-entry-stream": crate::p2::filesystem::ReaddirIterator,
- "wasi:filesystem/types/descriptor": crate::filesystem::Descriptor,
- "wasi:cli/terminal-input/terminal-input": crate::p2::stdio::TerminalInput,
- "wasi:cli/terminal-output/terminal-output": crate::p2::stdio::TerminalOutput,
+ "wasi:sockets/network.network": crate::p2::network::Network,
+ "wasi:sockets/tcp.tcp-socket": crate::sockets::TcpSocket,
+ "wasi:sockets/udp.udp-socket": crate::sockets::UdpSocket,
+ "wasi:sockets/udp.incoming-datagram-stream": crate::p2::udp::IncomingDatagramStream,
+ "wasi:sockets/udp.outgoing-datagram-stream": crate::p2::udp::OutgoingDatagramStream,
+ "wasi:sockets/ip-name-lookup.resolve-address-stream": crate::p2::ip_name_lookup::ResolveAddressStream,
+ "wasi:filesystem/types.directory-entry-stream": crate::p2::filesystem::ReaddirIterator,
+ "wasi:filesystem/types.descriptor": crate::filesystem::Descriptor,
+ "wasi:cli/terminal-input.terminal-input": crate::p2::stdio::TerminalInput,
+ "wasi:cli/terminal-output.terminal-output": crate::p2::stdio::TerminalOutput,
},
});
}
diff --git a/crates/wasi/src/p3/bindings.rs b/crates/wasi/src/p3/bindings.rs
index d5dfac16b7..53f0d0d536 100644
--- a/crates/wasi/src/p3/bindings.rs
+++ b/crates/wasi/src/p3/bindings.rs
@@ -82,25 +82,25 @@ mod generated {
"wasi:cli/stdin": async | store | tracing | trappable,
"wasi:cli/stdout": async | store | tracing | trappable,
"wasi:cli/stderr": async | store | tracing | trappable,
- "wasi:filesystem/types/[method]descriptor.read-via-stream": async | store | tracing | trappable,
- "wasi:sockets/types/[method]tcp-socket.bind": async | store | tracing | trappable,
- "wasi:sockets/types/[method]tcp-socket.listen": async | store | tracing | trappable,
- "wasi:sockets/types/[method]tcp-socket.receive": async | store | tracing | trappable,
- "wasi:sockets/types/[method]udp-socket.bind": async | store | tracing | trappable,
- "wasi:sockets/types/[method]udp-socket.connect": async | store | tracing | trappable,
+ "wasi:filesystem/types.[method]descriptor.read-via-stream": async | store | tracing | trappable,
+ "wasi:sockets/types.[method]tcp-socket.bind": async | store | tracing | trappable,
+ "wasi:sockets/types.[method]tcp-socket.listen": async | store | tracing | trappable,
+ "wasi:sockets/types.[method]tcp-socket.receive": async | store | tracing | trappable,
+ "wasi:sockets/types.[method]udp-socket.bind": async | store | tracing | trappable,
+ "wasi:sockets/types.[method]udp-socket.connect": async | store | tracing | trappable,
default: tracing | trappable,
},
exports: { default: async | store },
with: {
- "wasi:cli/terminal-input/terminal-input": crate::p3::cli::TerminalInput,
- "wasi:cli/terminal-output/terminal-output": crate::p3::cli::TerminalOutput,
- "wasi:filesystem/types/descriptor": crate::filesystem::Descriptor,
- "wasi:sockets/types/tcp-socket": crate::sockets::TcpSocket,
- "wasi:sockets/types/udp-socket": crate::sockets::UdpSocket,
+ "wasi:cli/terminal-input.terminal-input": crate::p3::cli::TerminalInput,
+ "wasi:cli/terminal-output.terminal-output": crate::p3::cli::TerminalOutput,
+ "wasi:filesystem/types.descriptor": crate::filesystem::Descriptor,
+ "wasi:sockets/types.tcp-socket": crate::sockets::TcpSocket,
+ "wasi:sockets/types.udp-socket": crate::sockets::UdpSocket,
},
trappable_error_type: {
- "wasi:filesystem/types/error-code" => crate::p3::filesystem::FilesystemError,
- "wasi:sockets/types/error-code" => crate::p3::sockets::SocketError,
+ "wasi:filesystem/types.error-code" => crate::p3::filesystem::FilesystemError,
+ "wasi:sockets/types.error-code" => crate::p3::sockets::SocketError,
},
});
}
diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs
index 1cc4513576..b182a8ab12 100644
--- a/crates/wasmtime/src/config.rs
+++ b/crates/wasmtime/src/config.rs
@@ -662,7 +662,7 @@ impl Config {
///
/// Epochs (and fuel) do not assist in handling WebAssembly code blocked in
/// a call to the host. For example if the WebAssembly function calls
- /// `wasi:io/poll/poll` to sleep epochs will not assist in waking this up or
+ /// `wasi:io/poll.poll` to sleep epochs will not assist in waking this up or
/// timing it out. Epochs intentionally only affect running WebAssembly code
/// itself and it's left to the embedder to determine how best to wake up
/// indefinitely blocking code in the host.
diff --git a/crates/wasmtime/src/runtime/component/bindgen_examples/_4_imported_resources.rs b/crates/wasmtime/src/runtime/component/bindgen_examples/_4_imported_resources.rs
index b84579bc2f..e5c8fcdf35 100644
--- a/crates/wasmtime/src/runtime/component/bindgen_examples/_4_imported_resources.rs
+++ b/crates/wasmtime/src/runtime/component/bindgen_examples/_4_imported_resources.rs
@@ -28,7 +28,7 @@ bindgen!({
with: {
// Specify that our host resource is going to point to the `MyLogger`
// which is defined just below this macro.
- "example:imported-resources/logging/logger": MyLogger,
+ "example:imported-resources/logging.logger": MyLogger,
},
// Interactions with `ResourceTable` can possibly trap so enable the ability
diff --git a/crates/wasmtime/src/runtime/component/bindgen_examples/_7_async.rs b/crates/wasmtime/src/runtime/component/bindgen_examples/_7_async.rs
index e5cc07100d..16b83995b1 100644
--- a/crates/wasmtime/src/runtime/component/bindgen_examples/_7_async.rs
+++ b/crates/wasmtime/src/runtime/component/bindgen_examples/_7_async.rs
@@ -34,7 +34,7 @@ bindgen!({
with: {
// Specify that our host resource is going to point to the `MyLogger`
// which is defined just below this macro.
- "example:imported-resources/logging/logger": MyLogger,
+ "example:imported-resources/logging.logger": MyLogger,
},
});
diff --git a/crates/wasmtime/src/runtime/component/mod.rs b/crates/wasmtime/src/runtime/component/mod.rs
index 8092300f59..4f2bd48a61 100644
--- a/crates/wasmtime/src/runtime/component/mod.rs
+++ b/crates/wasmtime/src/runtime/component/mod.rs
@@ -290,7 +290,7 @@ pub(crate) use self::store::ComponentStoreData;
/// // to do async I/O. Note though that to WebAssembly itself the
/// // function will still be blocking. This requires
/// // `Config::async_support` to be `true` as well.
-/// "wasi:io/poll/poll": async,
+/// "wasi:io/poll.poll": async,
///
/// // The `store` flag means that the host function will have access
/// // to the store during its execution. By default host functions take
@@ -306,7 +306,7 @@ pub(crate) use self::store::ComponentStoreData;
/// // > Note: this is not yet implemented for non-async functions. This
/// // > will result in bindgen errors right now and is intended to be
/// // > implemented in the near future.
-/// "wasi:clocks/monotonic-clock/now": store,
+/// "wasi:clocks/monotonic-clock.now": store,
///
/// // This is an example of combining flags where the `async` and
/// // `store` flags are combined. This means that the generated
@@ -316,7 +316,7 @@ pub(crate) use self::store::ComponentStoreData;
/// // means that this is the default already applied meaning that
/// // specifying it here would be redundant.
/// //
-/// // "wasi:clocks/monotonic-clock/[async]wait-until": async | store,
+/// // "wasi:clocks/monotonic-clock.[async]wait-until": async | store,
///
/// // The `tracing` flag indicates that `tracing!` will be used to log
/// // entries and exits into this host API. This can assist with
@@ -324,12 +324,12 @@ pub(crate) use self::store::ComponentStoreData;
/// //
/// // By default values are traced unless they contain lists, but
/// // tracing of lists can be enabled with `verbose_tracing` below.
-/// "my:local/api/foo": tracing,
+/// "my:local/api.foo": tracing,
///
/// // The `verbose_tracing` flag indicates that when combined with
/// // `tracing` the values of parameters/results are added to logs.
/// // This may include lists which may be very large.
-/// "my:local/api/other-function": tracing | verbose_tracing,
+/// "my:local/api.other-function": tracing | verbose_tracing,
///
/// // The `trappable` flag indicates that this import is allowed to
/// // generate a trap.
@@ -345,12 +345,12 @@ pub(crate) use self::store::ComponentStoreData;
/// // `trappable_error_type` configuration below to avoid having a
/// // host function return `wasmtime::Result<Result<WitOk, WitErr>>`
/// // for example and instead return `Result<WitOk, RustErrorType>`.
-/// "my:local/api/fallible": trappable,
+/// "my:local/api.fallible": trappable,
///
/// // The `ignore_wit` flag discards the WIT-level defaults of a
/// // function. For example this `async` WIT function will be ignored
/// // and a synchronous function will be generated on the host.
-/// "my:local/api/[async]wait": ignore_wit,
+/// "my:local/api.[async]wait": ignore_wit,
///
/// // The `exact` flag ensures that the filter, here "f", only matches
/// // functions exactly. For example "f" here would only refer to
@@ -378,7 +378,7 @@ pub(crate) use self::store::ComponentStoreData;
/// // this function should return a tuple of the result produced by the
/// // callee and a `TaskExit` future which will resolve when the task
/// // (and any transitively created subtasks) have exited.
-/// "my:local/api/[async]does-stuff-after-returning": task_exit,
+/// "my:local/api.[async]does-stuff-after-returning": task_exit,
/// },
///
/// // This can be used to translate WIT return values of the form
@@ -392,7 +392,7 @@ pub(crate) use self::store::ComponentStoreData;
/// // By default this option is not specified. This option only takes
/// // effect when `trappable` is set for some imports.
/// trappable_error_type: {
-/// "wasi:io/streams/stream-error" => RustErrorType,
+/// "wasi:io/streams.stream-error" => RustErrorType,
/// },
///
/// // All generated bindgen types are "owned" meaning types like `String`
@@ -443,7 +443,7 @@ pub(crate) use self::store::ComponentStoreData;
/// // import bindings of `Resource<T>`. This can be done to configure
/// // which typed resource shows up in generated bindings and can be
/// // useful when working with the typed methods of `ResourceTable`.
-/// "wasi:filesystem/types/descriptor": MyDescriptorType,
+/// "wasi:filesystem/types.descriptor": MyDescriptorType,
/// },
///
/// // Additional derive attributes to include on generated types (structs or enums).
diff --git a/crates/wit-bindgen/src/lib.rs b/crates/wit-bindgen/src/lib.rs
index 3ec5e6cc14..e951398abd 100644
--- a/crates/wit-bindgen/src/lib.rs
+++ b/crates/wit-bindgen/src/lib.rs
@@ -184,7 +184,7 @@ pub struct Opts {
#[derive(Debug, Clone)]
pub struct TrappableError {
- /// Full path to the error, such as `wasi:io/streams/error`.
+ /// Full path to the error, such as `wasi:io/streams.error`.
pub wit_path: String,
/// The name, in Rust, of the error type to generate.
@@ -335,7 +335,7 @@ impl Wasmtime {
) {
assert!(projection.is_empty());
- // If `wit_path` looks like `{key}/{type_name}` where
+ // If `wit_path` looks like `{key}.{type_name}` where
// `type_name` is a type within `iface` then we've found a
// match. Otherwise continue to the next lookup key if there
// is one, and failing that continue to the next interface.
@@ -343,7 +343,7 @@ impl Wasmtime {
Some(s) => s,
None => continue,
};
- let suffix = match suffix.strip_prefix('/') {
+ let suffix = match suffix.strip_prefix('.') {
Some(s) => s,
None => continue,
};
@@ -1149,7 +1149,7 @@ fn lookup_keys(
// they're relatively uncommon so only lookup the precise key here.
WorldKey::Name(key) => {
let to_lookup = match item {
- LookupItem::Name(item) => format!("{key}/{item}"),
+ LookupItem::Name(item) => format!("{key}.{item}"),
LookupItem::None | LookupItem::InterfaceNoPop => key.to_string(),
};
return vec![(to_lookup, Vec::new())];
@@ -1193,7 +1193,7 @@ fn lookup_keys(
fn lookup_key(&self, resolve: &Resolve) -> String {
let mut s = self.prefix.lookup_key(resolve);
if let Some(item) = self.item {
- s.push_str("/");
+ s.push_str(".");
s.push_str(item);
}
s
diff --git a/examples/resource-component/main.rs b/examples/resource-component/main.rs
index 2b6b73bd3f..d37208cf30 100644
--- a/examples/resource-component/main.rs
+++ b/examples/resource-component/main.rs
@@ -53,7 +53,7 @@ bindgen!({
imports: { default: async | trappable },
exports: { default: async },
with: {
- "example:kv-store/kvdb/connection": Connection
+ "example:kv-store/kvdb.connection": Connection
},
});
diff --git a/tests/all/component_model/bindgen/results.rs b/tests/all/component_model/bindgen/results.rs
index 09353d3714..2ad46d7a4a 100644
--- a/tests/all/component_model/bindgen/results.rs
+++ b/tests/all/component_model/bindgen/results.rs
@@ -245,7 +245,7 @@ mod enum_error {
enum-error: func(a: f64) -> result<f64, e1>;
}
}",
- trappable_error_type: { "inline:inline/imports/e1" => TrappableE1 },
+ trappable_error_type: { "inline:inline/imports.e1" => TrappableE1 },
imports: { default: trappable },
});
@@ -427,7 +427,7 @@ mod record_error {
record-error: func(a: f64) -> result<f64, e2>;
}
}",
- trappable_error_type: { "inline:inline/imports/e2" => TrappableE2 },
+ trappable_error_type: { "inline:inline/imports.e2" => TrappableE2 },
imports: { default: trappable },
});
@@ -600,7 +600,7 @@ mod variant_error {
variant-error: func(a: f64) -> result<f64, e3>;
}
}",
- trappable_error_type: { "inline:inline/imports/e3" => TrappableE3 },
+ trappable_error_type: { "inline:inline/imports.e3" => TrappableE3 },
imports: { default: trappable },
});
@@ -797,7 +797,7 @@ mod multiple_interfaces_error {
enum-error: func(a: f64) -> result<f64, e1>;
}
}",
- trappable_error_type: { "inline:inline/types/e1" => TrappableE1 },
+ trappable_error_type: { "inline:inline/types.e1" => TrappableE1 },
imports: { default: trappable },
});