Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f8fc485

Browse files
committedJan 30, 2025
fmt: format all wit files
1 parent ee451dd commit f8fc485

14 files changed

+836
-837
lines changed
 

‎wasip2/cli/command.wit

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ package wasi:cli@0.2.3;
22

33
@since(version = 0.2.0)
44
world command {
5-
@since(version = 0.2.0)
6-
include imports;
5+
@since(version = 0.2.0)
6+
include imports;
77

8-
@since(version = 0.2.0)
9-
export run;
8+
@since(version = 0.2.0)
9+
export run;
1010
}

‎wasip2/cli/environment.wit

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
@since(version = 0.2.0)
22
interface environment {
3-
/// Get the POSIX-style environment variables.
4-
///
5-
/// Each environment variable is provided as a pair of string variable names
6-
/// and string value.
7-
///
8-
/// Morally, these are a value import, but until value imports are available
9-
/// in the component model, this import function should return the same
10-
/// values each time it is called.
11-
@since(version = 0.2.0)
12-
get-environment: func() -> list<tuple<string, string>>;
3+
/// Get the POSIX-style environment variables.
4+
///
5+
/// Each environment variable is provided as a pair of string variable names
6+
/// and string value.
7+
///
8+
/// Morally, these are a value import, but until value imports are available
9+
/// in the component model, this import function should return the same
10+
/// values each time it is called.
11+
@since(version = 0.2.0)
12+
get-environment: func() -> list<tuple<string, string>>;
1313

14-
/// Get the POSIX-style arguments to the program.
15-
@since(version = 0.2.0)
16-
get-arguments: func() -> list<string>;
14+
/// Get the POSIX-style arguments to the program.
15+
@since(version = 0.2.0)
16+
get-arguments: func() -> list<string>;
1717

18-
/// Return a path that programs should use as their initial current working
19-
/// directory, interpreting `.` as shorthand for this.
20-
@since(version = 0.2.0)
21-
initial-cwd: func() -> option<string>;
18+
/// Return a path that programs should use as their initial current working
19+
/// directory, interpreting `.` as shorthand for this.
20+
@since(version = 0.2.0)
21+
initial-cwd: func() -> option<string>;
2222
}

‎wasip2/cli/exit.wit

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
@since(version = 0.2.0)
22
interface exit {
3-
/// Exit the current instance and any linked instances.
4-
@since(version = 0.2.0)
5-
exit: func(status: result);
3+
/// Exit the current instance and any linked instances.
4+
@since(version = 0.2.0)
5+
exit: func(status: result);
66

7-
/// Exit the current instance and any linked instances, reporting the
8-
/// specified status code to the host.
9-
///
10-
/// The meaning of the code depends on the context, with 0 usually meaning
11-
/// "success", and other values indicating various types of failure.
12-
///
13-
/// This function does not return; the effect is analogous to a trap, but
14-
/// without the connotation that something bad has happened.
15-
@unstable(feature = cli-exit-with-code)
16-
exit-with-code: func(status-code: u8);
7+
/// Exit the current instance and any linked instances, reporting the
8+
/// specified status code to the host.
9+
///
10+
/// The meaning of the code depends on the context, with 0 usually meaning
11+
/// "success", and other values indicating various types of failure.
12+
///
13+
/// This function does not return; the effect is analogous to a trap, but
14+
/// without the connotation that something bad has happened.
15+
@unstable(feature = cli-exit-with-code)
16+
exit-with-code: func(status-code: u8);
1717
}

‎wasip2/cli/imports.wit

+30-30
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,35 @@ package wasi:cli@0.2.3;
22

33
@since(version = 0.2.0)
44
world imports {
5-
@since(version = 0.2.0)
6-
include wasi:clocks/imports@0.2.3;
7-
@since(version = 0.2.0)
8-
include wasi:filesystem/imports@0.2.3;
9-
@since(version = 0.2.0)
10-
include wasi:sockets/imports@0.2.3;
11-
@since(version = 0.2.0)
12-
include wasi:random/imports@0.2.3;
13-
@since(version = 0.2.0)
14-
include wasi:io/imports@0.2.3;
5+
@since(version = 0.2.0)
6+
include wasi:clocks/imports@0.2.3;
7+
@since(version = 0.2.0)
8+
include wasi:filesystem/imports@0.2.3;
9+
@since(version = 0.2.0)
10+
include wasi:sockets/imports@0.2.3;
11+
@since(version = 0.2.0)
12+
include wasi:random/imports@0.2.3;
13+
@since(version = 0.2.0)
14+
include wasi:io/imports@0.2.3;
1515

16-
@since(version = 0.2.0)
17-
import environment;
18-
@since(version = 0.2.0)
19-
import exit;
20-
@since(version = 0.2.0)
21-
import stdin;
22-
@since(version = 0.2.0)
23-
import stdout;
24-
@since(version = 0.2.0)
25-
import stderr;
26-
@since(version = 0.2.0)
27-
import terminal-input;
28-
@since(version = 0.2.0)
29-
import terminal-output;
30-
@since(version = 0.2.0)
31-
import terminal-stdin;
32-
@since(version = 0.2.0)
33-
import terminal-stdout;
34-
@since(version = 0.2.0)
35-
import terminal-stderr;
16+
@since(version = 0.2.0)
17+
import environment;
18+
@since(version = 0.2.0)
19+
import exit;
20+
@since(version = 0.2.0)
21+
import stdin;
22+
@since(version = 0.2.0)
23+
import stdout;
24+
@since(version = 0.2.0)
25+
import stderr;
26+
@since(version = 0.2.0)
27+
import terminal-input;
28+
@since(version = 0.2.0)
29+
import terminal-output;
30+
@since(version = 0.2.0)
31+
import terminal-stdin;
32+
@since(version = 0.2.0)
33+
import terminal-stdout;
34+
@since(version = 0.2.0)
35+
import terminal-stderr;
3636
}

‎wasip2/cli/run.wit

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@since(version = 0.2.0)
22
interface run {
3-
/// Run the program.
4-
@since(version = 0.2.0)
5-
run: func() -> result;
3+
/// Run the program.
4+
@since(version = 0.2.0)
5+
run: func() -> result;
66
}

‎wasip2/cli/stdio.wit

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
@since(version = 0.2.0)
22
interface stdin {
3-
@since(version = 0.2.0)
4-
use wasi:io/streams@0.2.3.{input-stream};
3+
@since(version = 0.2.0)
4+
use wasi:io/streams@0.2.3.{input-stream};
55

6-
@since(version = 0.2.0)
7-
get-stdin: func() -> input-stream;
6+
@since(version = 0.2.0)
7+
get-stdin: func() -> input-stream;
88
}
99

1010
@since(version = 0.2.0)
1111
interface stdout {
12-
@since(version = 0.2.0)
13-
use wasi:io/streams@0.2.3.{output-stream};
12+
@since(version = 0.2.0)
13+
use wasi:io/streams@0.2.3.{output-stream};
1414

15-
@since(version = 0.2.0)
16-
get-stdout: func() -> output-stream;
15+
@since(version = 0.2.0)
16+
get-stdout: func() -> output-stream;
1717
}
1818

1919
@since(version = 0.2.0)
2020
interface stderr {
21-
@since(version = 0.2.0)
22-
use wasi:io/streams@0.2.3.{output-stream};
21+
@since(version = 0.2.0)
22+
use wasi:io/streams@0.2.3.{output-stream};
2323

24-
@since(version = 0.2.0)
25-
get-stderr: func() -> output-stream;
24+
@since(version = 0.2.0)
25+
get-stderr: func() -> output-stream;
2626
}

‎wasip2/filesystem/types.wit

+4-4
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,10 @@ interface types {
285285
/// 128-bit integer type.
286286
@since(version = 0.2.0)
287287
record metadata-hash-value {
288-
/// 64 bits of a 128-bit hash value.
289-
lower: u64,
290-
/// Another 64 bits of a 128-bit hash value.
291-
upper: u64,
288+
/// 64 bits of a 128-bit hash value.
289+
lower: u64,
290+
/// Another 64 bits of a 128-bit hash value.
291+
upper: u64,
292292
}
293293

294294
/// A descriptor is a reference to a filesystem object, which may be a file,

‎wasip2/http/handler.wit

+35-35
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,48 @@
22
/// be exported by components which can respond to HTTP Requests.
33
@since(version = 0.2.0)
44
interface incoming-handler {
5-
@since(version = 0.2.0)
6-
use types.{incoming-request, response-outparam};
5+
@since(version = 0.2.0)
6+
use types.{incoming-request, response-outparam};
77

8-
/// This function is invoked with an incoming HTTP Request, and a resource
9-
/// `response-outparam` which provides the capability to reply with an HTTP
10-
/// Response. The response is sent by calling the `response-outparam.set`
11-
/// method, which allows execution to continue after the response has been
12-
/// sent. This enables both streaming to the response body, and performing other
13-
/// work.
14-
///
15-
/// The implementor of this function must write a response to the
16-
/// `response-outparam` before returning, or else the caller will respond
17-
/// with an error on its behalf.
18-
@since(version = 0.2.0)
19-
handle: func(
20-
request: incoming-request,
21-
response-out: response-outparam
22-
);
8+
/// This function is invoked with an incoming HTTP Request, and a resource
9+
/// `response-outparam` which provides the capability to reply with an HTTP
10+
/// Response. The response is sent by calling the `response-outparam.set`
11+
/// method, which allows execution to continue after the response has been
12+
/// sent. This enables both streaming to the response body, and performing other
13+
/// work.
14+
///
15+
/// The implementor of this function must write a response to the
16+
/// `response-outparam` before returning, or else the caller will respond
17+
/// with an error on its behalf.
18+
@since(version = 0.2.0)
19+
handle: func(
20+
request: incoming-request,
21+
response-out: response-outparam
22+
);
2323
}
2424

2525
/// This interface defines a handler of outgoing HTTP Requests. It should be
2626
/// imported by components which wish to make HTTP Requests.
2727
@since(version = 0.2.0)
2828
interface outgoing-handler {
29-
@since(version = 0.2.0)
30-
use types.{
29+
@since(version = 0.2.0)
30+
use types.{
3131
outgoing-request, request-options, future-incoming-response, error-code
32-
};
32+
};
3333

34-
/// This function is invoked with an outgoing HTTP Request, and it returns
35-
/// a resource `future-incoming-response` which represents an HTTP Response
36-
/// which may arrive in the future.
37-
///
38-
/// The `options` argument accepts optional parameters for the HTTP
39-
/// protocol's transport layer.
40-
///
41-
/// This function may return an error if the `outgoing-request` is invalid
42-
/// or not allowed to be made. Otherwise, protocol errors are reported
43-
/// through the `future-incoming-response`.
44-
@since(version = 0.2.0)
45-
handle: func(
46-
request: outgoing-request,
47-
options: option<request-options>
48-
) -> result<future-incoming-response, error-code>;
34+
/// This function is invoked with an outgoing HTTP Request, and it returns
35+
/// a resource `future-incoming-response` which represents an HTTP Response
36+
/// which may arrive in the future.
37+
///
38+
/// The `options` argument accepts optional parameters for the HTTP
39+
/// protocol's transport layer.
40+
///
41+
/// This function may return an error if the `outgoing-request` is invalid
42+
/// or not allowed to be made. Otherwise, protocol errors are reported
43+
/// through the `future-incoming-response`.
44+
@since(version = 0.2.0)
45+
handle: func(
46+
request: outgoing-request,
47+
options: option<request-options>
48+
) -> result<future-incoming-response, error-code>;
4949
}

‎wasip2/http/proxy.wit

+31-31
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,32 @@ package wasi:http@0.2.3;
44
/// It is intended to be `include`d in other worlds.
55
@since(version = 0.2.0)
66
world imports {
7-
/// HTTP proxies have access to time and randomness.
8-
@since(version = 0.2.0)
9-
import wasi:clocks/monotonic-clock@0.2.3;
10-
@since(version = 0.2.0)
11-
import wasi:clocks/wall-clock@0.2.3;
12-
@since(version = 0.2.0)
13-
import wasi:random/random@0.2.3;
7+
/// HTTP proxies have access to time and randomness.
8+
@since(version = 0.2.0)
9+
import wasi:clocks/monotonic-clock@0.2.3;
10+
@since(version = 0.2.0)
11+
import wasi:clocks/wall-clock@0.2.3;
12+
@since(version = 0.2.0)
13+
import wasi:random/random@0.2.3;
1414

15-
/// Proxies have standard output and error streams which are expected to
16-
/// terminate in a developer-facing console provided by the host.
17-
@since(version = 0.2.0)
18-
import wasi:cli/stdout@0.2.3;
19-
@since(version = 0.2.0)
20-
import wasi:cli/stderr@0.2.3;
15+
/// Proxies have standard output and error streams which are expected to
16+
/// terminate in a developer-facing console provided by the host.
17+
@since(version = 0.2.0)
18+
import wasi:cli/stdout@0.2.3;
19+
@since(version = 0.2.0)
20+
import wasi:cli/stderr@0.2.3;
2121

22-
/// TODO: this is a temporary workaround until component tooling is able to
23-
/// gracefully handle the absence of stdin. Hosts must return an eof stream
24-
/// for this import, which is what wasi-libc + tooling will do automatically
25-
/// when this import is properly removed.
26-
@since(version = 0.2.0)
27-
import wasi:cli/stdin@0.2.3;
22+
/// TODO: this is a temporary workaround until component tooling is able to
23+
/// gracefully handle the absence of stdin. Hosts must return an eof stream
24+
/// for this import, which is what wasi-libc + tooling will do automatically
25+
/// when this import is properly removed.
26+
@since(version = 0.2.0)
27+
import wasi:cli/stdin@0.2.3;
2828

29-
/// This is the default handler to use when user code simply wants to make an
30-
/// HTTP request (e.g., via `fetch()`).
31-
@since(version = 0.2.0)
32-
import outgoing-handler;
29+
/// This is the default handler to use when user code simply wants to make an
30+
/// HTTP request (e.g., via `fetch()`).
31+
@since(version = 0.2.0)
32+
import outgoing-handler;
3333
}
3434

3535
/// The `wasi:http/proxy` world captures a widely-implementable intersection of
@@ -38,13 +38,13 @@ world imports {
3838
/// outgoing HTTP requests.
3939
@since(version = 0.2.0)
4040
world proxy {
41-
@since(version = 0.2.0)
42-
include imports;
41+
@since(version = 0.2.0)
42+
include imports;
4343

44-
/// The host delivers incoming HTTP requests to a component by calling the
45-
/// `handle` function of this exported interface. A host may arbitrarily reuse
46-
/// or not reuse component instance when delivering incoming HTTP requests and
47-
/// thus a component must be able to handle 0..N calls to `handle`.
48-
@since(version = 0.2.0)
49-
export incoming-handler;
44+
/// The host delivers incoming HTTP requests to a component by calling the
45+
/// `handle` function of this exported interface. A host may arbitrarily reuse
46+
/// or not reuse component instance when delivering incoming HTTP requests and
47+
/// thus a component must be able to handle 0..N calls to `handle`.
48+
@since(version = 0.2.0)
49+
export incoming-handler;
5050
}

‎wasip2/http/types.wit

+666-666
Large diffs are not rendered by default.

‎wasip2/io/poll.wit

+12-12
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ interface poll {
88
@since(version = 0.2.0)
99
resource pollable {
1010

11-
/// Return the readiness of a pollable. This function never blocks.
12-
///
13-
/// Returns `true` when the pollable is ready, and `false` otherwise.
14-
@since(version = 0.2.0)
15-
ready: func() -> bool;
11+
/// Return the readiness of a pollable. This function never blocks.
12+
///
13+
/// Returns `true` when the pollable is ready, and `false` otherwise.
14+
@since(version = 0.2.0)
15+
ready: func() -> bool;
1616

17-
/// `block` returns immediately if the pollable is ready, and otherwise
18-
/// blocks until ready.
19-
///
20-
/// This function is equivalent to calling `poll.poll` on a list
21-
/// containing only this pollable.
22-
@since(version = 0.2.0)
23-
block: func();
17+
/// `block` returns immediately if the pollable is ready, and otherwise
18+
/// blocks until ready.
19+
///
20+
/// This function is equivalent to calling `poll.poll` on a list
21+
/// containing only this pollable.
22+
@since(version = 0.2.0)
23+
block: func();
2424
}
2525

2626
/// Poll for completion on a set of pollables.

‎wasip2/sockets/instance-network.wit

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/// This interface provides a value-export of the default network handle..
32
@since(version = 0.2.0)
43
interface instance-network {

‎wasip2/sockets/tcp.wit

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface tcp {
2020
/// Similar to `SHUT_RDWR` in POSIX.
2121
both,
2222
}
23-
23+
2424
/// A TCP socket resource.
2525
///
2626
/// The socket can be in one of the following states:
@@ -65,10 +65,10 @@ interface tcp {
6565
/// - `address-not-bindable`: `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL)
6666
/// - `not-in-progress`: A `bind` operation is not in progress.
6767
/// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN)
68-
///
68+
///
6969
/// # Implementors note
7070
/// When binding to a non-zero port, this bind operation shouldn't be affected by the TIME_WAIT
71-
/// state of a recently closed socket on the same local address. In practice this means that the SO_REUSEADDR
71+
/// state of a recently closed socket on the same local address. In practice this means that the SO_REUSEADDR
7272
/// socket option should be set implicitly on all platforms, except on Windows where this is the default behavior
7373
/// and SO_REUSEADDR performs something different entirely.
7474
///

‎wasip2/sockets/udp.wit

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface udp {
99
@since(version = 0.2.0)
1010
record incoming-datagram {
1111
/// The payload.
12-
///
12+
///
1313
/// Theoretical max size: ~64 KiB. In practice, typically less than 1500 bytes.
1414
data: list<u8>,
1515

@@ -84,7 +84,7 @@ interface udp {
8484
/// This method may be called multiple times on the same socket to change its association, but
8585
/// only the most recently returned pair of streams will be operational. Implementations may trap if
8686
/// the streams returned by a previous invocation haven't been dropped yet before calling `stream` again.
87-
///
87+
///
8888
/// The POSIX equivalent in pseudo-code is:
8989
/// ```text
9090
/// if (was previously connected) {
@@ -96,7 +96,7 @@ interface udp {
9696
/// ```
9797
///
9898
/// Unlike in POSIX, the socket must already be explicitly bound.
99-
///
99+
///
100100
/// # Typical errors
101101
/// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT)
102102
/// - `invalid-argument`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL)
@@ -121,7 +121,7 @@ interface udp {
121121
/// > stored in the object pointed to by `address` is unspecified.
122122
///
123123
/// WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet.
124-
///
124+
///
125125
/// # Typical errors
126126
/// - `invalid-state`: The socket is not bound to any local address.
127127
///
@@ -237,7 +237,7 @@ interface udp {
237237
/// When this function returns ok(0), the `subscribe` pollable will
238238
/// become ready when this function will report at least ok(1), or an
239239
/// error.
240-
///
240+
///
241241
/// Never returns `would-block`.
242242
check-send: func() -> result<u64, error-code>;
243243

@@ -277,7 +277,7 @@ interface udp {
277277
/// - <https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2>
278278
@since(version = 0.2.0)
279279
send: func(datagrams: list<outgoing-datagram>) -> result<u64, error-code>;
280-
280+
281281
/// Create a `pollable` which will resolve once the stream is ready to send again.
282282
///
283283
/// Note: this function is here for WASI 0.2 only.

0 commit comments

Comments
 (0)
Please sign in to comment.