Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

Commit f2ffc74

Browse files
authored
Merge pull request #99 from WebAssembly/pch/preview2
Release Preview 2: set package version to 0.2.0
2 parents 168cf96 + 4f236c6 commit f2ffc74

File tree

13 files changed

+72
-52
lines changed

13 files changed

+72
-52
lines changed

imports.md

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
<ul>
33
<li>Imports:
44
<ul>
5-
<li>interface <a href="#wasi:sockets_network_0.2.0_rc_2024_01_16"><code>wasi:sockets/[email protected]-rc-2024-01-16</code></a></li>
6-
<li>interface <a href="#wasi:sockets_instance_network_0.2.0_rc_2024_01_16"><code>wasi:sockets/[email protected]-rc-2024-01-16</code></a></li>
7-
<li>interface <a href="#wasi:io_poll_0.2.0_rc_2023_11_10"><code>wasi:io/[email protected]-rc-2023-11-10</code></a></li>
8-
<li>interface <a href="#wasi:sockets_udp_0.2.0_rc_2024_01_16"><code>wasi:sockets/[email protected]-rc-2024-01-16</code></a></li>
9-
<li>interface <a href="#wasi:sockets_udp_create_socket_0.2.0_rc_2024_01_16"><code>wasi:sockets/[email protected]-rc-2024-01-16</code></a></li>
10-
<li>interface <a href="#wasi:io_error_0.2.0_rc_2023_11_10"><code>wasi:io/[email protected]-rc-2023-11-10</code></a></li>
11-
<li>interface <a href="#wasi:io_streams_0.2.0_rc_2023_11_10"><code>wasi:io/[email protected]-rc-2023-11-10</code></a></li>
12-
<li>interface <a href="#wasi:clocks_monotonic_clock_0.2.0_rc_2023_11_10"><code>wasi:clocks/[email protected]-rc-2023-11-10</code></a></li>
13-
<li>interface <a href="#wasi:sockets_tcp_0.2.0_rc_2024_01_16"><code>wasi:sockets/[email protected]-rc-2024-01-16</code></a></li>
14-
<li>interface <a href="#wasi:sockets_tcp_create_socket_0.2.0_rc_2024_01_16"><code>wasi:sockets/[email protected]-rc-2024-01-16</code></a></li>
15-
<li>interface <a href="#wasi:sockets_ip_name_lookup_0.2.0_rc_2024_01_16"><code>wasi:sockets/[email protected]-rc-2024-01-16</code></a></li>
5+
<li>interface <a href="#wasi:sockets_network_0.2.0"><code>wasi:sockets/[email protected]</code></a></li>
6+
<li>interface <a href="#wasi:sockets_instance_network_0.2.0"><code>wasi:sockets/[email protected]</code></a></li>
7+
<li>interface <a href="#wasi:io_poll_0.2.0"><code>wasi:io/[email protected]</code></a></li>
8+
<li>interface <a href="#wasi:sockets_udp_0.2.0"><code>wasi:sockets/[email protected]</code></a></li>
9+
<li>interface <a href="#wasi:sockets_udp_create_socket_0.2.0"><code>wasi:sockets/[email protected]</code></a></li>
10+
<li>interface <a href="#wasi:io_error_0.2.0"><code>wasi:io/[email protected]</code></a></li>
11+
<li>interface <a href="#wasi:io_streams_0.2.0"><code>wasi:io/[email protected]</code></a></li>
12+
<li>interface <a href="#wasi:clocks_monotonic_clock_0.2.0"><code>wasi:clocks/[email protected]</code></a></li>
13+
<li>interface <a href="#wasi:sockets_tcp_0.2.0"><code>wasi:sockets/[email protected]</code></a></li>
14+
<li>interface <a href="#wasi:sockets_tcp_create_socket_0.2.0"><code>wasi:sockets/[email protected]</code></a></li>
15+
<li>interface <a href="#wasi:sockets_ip_name_lookup_0.2.0"><code>wasi:sockets/[email protected]</code></a></li>
1616
</ul>
1717
</li>
1818
</ul>
19-
<h2><a name="wasi:sockets_network_0.2.0_rc_2024_01_16">Import interface wasi:sockets/[email protected]-rc-2024-01-16</a></h2>
19+
<h2><a name="wasi:sockets_network_0.2.0">Import interface wasi:sockets/[email protected]</a></h2>
2020
<hr />
2121
<h3>Types</h3>
2222
<h4><a name="network"><code>resource network</code></a></h4>
@@ -209,7 +209,7 @@ supported size.
209209
<li><a name="ip_socket_address.ipv4"><code>ipv4</code></a>: <a href="#ipv4_socket_address"><a href="#ipv4_socket_address"><code>ipv4-socket-address</code></a></a></li>
210210
<li><a name="ip_socket_address.ipv6"><code>ipv6</code></a>: <a href="#ipv6_socket_address"><a href="#ipv6_socket_address"><code>ipv6-socket-address</code></a></a></li>
211211
</ul>
212-
<h2><a name="wasi:sockets_instance_network_0.2.0_rc_2024_01_16">Import interface wasi:sockets/[email protected]-rc-2024-01-16</a></h2>
212+
<h2><a name="wasi:sockets_instance_network_0.2.0">Import interface wasi:sockets/[email protected]</a></h2>
213213
<p>This interface provides a value-export of the default network handle..</p>
214214
<hr />
215215
<h3>Types</h3>
@@ -224,13 +224,13 @@ supported size.
224224
<ul>
225225
<li><a name="instance_network.0"></a> own&lt;<a href="#network"><a href="#network"><code>network</code></a></a>&gt;</li>
226226
</ul>
227-
<h2><a name="wasi:io_poll_0.2.0_rc_2023_11_10">Import interface wasi:io/[email protected]-rc-2023-11-10</a></h2>
227+
<h2><a name="wasi:io_poll_0.2.0">Import interface wasi:io/[email protected]</a></h2>
228228
<p>A poll API intended to let users wait for I/O events on multiple handles
229229
at once.</p>
230230
<hr />
231231
<h3>Types</h3>
232232
<h4><a name="pollable"><code>resource pollable</code></a></h4>
233-
<h2><a href="#pollable"><code>pollable</code></a> epresents a single I/O event which may be ready, or not.</h2>
233+
<h2><a href="#pollable"><code>pollable</code></a> represents a single I/O event which may be ready, or not.</h2>
234234
<h3>Functions</h3>
235235
<h4><a name="method_pollable.ready"><code>[method]pollable.ready: func</code></a></h4>
236236
<p>Return the readiness of a pollable. This function never blocks.</p>
@@ -274,7 +274,7 @@ being reaedy for I/O.</p>
274274
<ul>
275275
<li><a name="poll.0"></a> list&lt;<code>u32</code>&gt;</li>
276276
</ul>
277-
<h2><a name="wasi:sockets_udp_0.2.0_rc_2024_01_16">Import interface wasi:sockets/[email protected]-rc-2024-01-16</a></h2>
277+
<h2><a name="wasi:sockets_udp_0.2.0">Import interface wasi:sockets/[email protected]</a></h2>
278278
<hr />
279279
<h3>Types</h3>
280280
<h4><a name="pollable"><code>type pollable</code></a></h4>
@@ -688,7 +688,7 @@ It's planned to be removed when <code>future</code> is natively supported in Pre
688688
<ul>
689689
<li><a name="method_outgoing_datagram_stream.subscribe.0"></a> own&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
690690
</ul>
691-
<h2><a name="wasi:sockets_udp_create_socket_0.2.0_rc_2024_01_16">Import interface wasi:sockets/[email protected]-rc-2024-01-16</a></h2>
691+
<h2><a name="wasi:sockets_udp_create_socket_0.2.0">Import interface wasi:sockets/[email protected]</a></h2>
692692
<hr />
693693
<h3>Types</h3>
694694
<h4><a name="network"><code>type network</code></a></h4>
@@ -733,7 +733,7 @@ the socket is effectively an in-memory configuration object, unable to communica
733733
<ul>
734734
<li><a name="create_udp_socket.0"></a> result&lt;own&lt;<a href="#udp_socket"><a href="#udp_socket"><code>udp-socket</code></a></a>&gt;, <a href="#error_code"><a href="#error_code"><code>error-code</code></a></a>&gt;</li>
735735
</ul>
736-
<h2><a name="wasi:io_error_0.2.0_rc_2023_11_10">Import interface wasi:io/[email protected]-rc-2023-11-10</a></h2>
736+
<h2><a name="wasi:io_error_0.2.0">Import interface wasi:io/[email protected]</a></h2>
737737
<hr />
738738
<h3>Types</h3>
739739
<h4><a name="error"><code>resource error</code></a></h4>
@@ -768,7 +768,7 @@ hazard.</p>
768768
<ul>
769769
<li><a name="method_error.to_debug_string.0"></a> <code>string</code></li>
770770
</ul>
771-
<h2><a name="wasi:io_streams_0.2.0_rc_2023_11_10">Import interface wasi:io/[email protected]-rc-2023-11-10</a></h2>
771+
<h2><a name="wasi:io_streams_0.2.0">Import interface wasi:io/[email protected]</a></h2>
772772
<p>WASI I/O is an I/O abstraction API which is currently focused on providing
773773
stream types.</p>
774774
<p>In the future, the component model is expected to add built-in stream types;
@@ -816,6 +816,10 @@ polled for using <code>wasi:io/poll</code>.</h2>
816816
<h3>Functions</h3>
817817
<h4><a name="method_input_stream.read"><code>[method]input-stream.read: func</code></a></h4>
818818
<p>Perform a non-blocking read from the stream.</p>
819+
<p>When the source of a <code>read</code> is binary data, the bytes from the source
820+
are returned verbatim. When the source of a <code>read</code> is known to the
821+
implementation to be text, bytes containing the UTF-8 encoding of the
822+
text are returned.</p>
819823
<p>This function returns a list of bytes containing the read data,
820824
when successful. The returned list will contain up to <code>len</code> bytes;
821825
it may return fewer than requested, but not more. The list is
@@ -911,6 +915,11 @@ error.</p>
911915
</ul>
912916
<h4><a name="method_output_stream.write"><code>[method]output-stream.write: func</code></a></h4>
913917
<p>Perform a write. This function never blocks.</p>
918+
<p>When the destination of a <code>write</code> is binary data, the bytes from
919+
<code>contents</code> are written verbatim. When the destination of a <code>write</code> is
920+
known to the implementation to be text, the bytes of <code>contents</code> are
921+
transcoded from UTF-8 into the encoding of the destination and then
922+
written.</p>
914923
<p>Precondition: check-write gave permit of Ok(n) and contents has a
915924
length of less than or equal to n. Otherwise, this function will trap.</p>
916925
<p>returns Err(closed) without writing if the stream has closed since
@@ -933,7 +942,7 @@ following pseudo-code:</p>
933942
<pre><code class="language-text">let pollable = this.subscribe();
934943
while !contents.is_empty() {
935944
// Wait for the stream to become writable
936-
poll-one(pollable);
945+
pollable.block();
937946
let Ok(n) = this.check-write(); // eliding error handling
938947
let len = min(n, contents.len());
939948
let (chunk, rest) = contents.split_at(len);
@@ -942,7 +951,7 @@ while !contents.is_empty() {
942951
}
943952
this.flush();
944953
// Wait for completion of `flush`
945-
poll-one(pollable);
954+
pollable.block();
946955
// Check for any errors that arose during `flush`
947956
let _ = this.check-write(); // eliding error handling
948957
</code></pre>
@@ -1002,7 +1011,7 @@ all derived <a href="#pollable"><code>pollable</code></a>s created with this fun
10021011
</ul>
10031012
<h4><a name="method_output_stream.write_zeroes"><code>[method]output-stream.write-zeroes: func</code></a></h4>
10041013
<p>Write zeroes to a stream.</p>
1005-
<p>this should be used precisely like <code>write</code> with the exact same
1014+
<p>This should be used precisely like <code>write</code> with the exact same
10061015
preconditions (must use check-write first), but instead of
10071016
passing a list of bytes, you simply pass the number of zero-bytes
10081017
that should be written.</p>
@@ -1025,15 +1034,15 @@ the following pseudo-code:</p>
10251034
<pre><code class="language-text">let pollable = this.subscribe();
10261035
while num_zeroes != 0 {
10271036
// Wait for the stream to become writable
1028-
poll-one(pollable);
1037+
pollable.block();
10291038
let Ok(n) = this.check-write(); // eliding error handling
10301039
let len = min(n, num_zeroes);
10311040
this.write-zeroes(len); // eliding error handling
10321041
num_zeroes -= len;
10331042
}
10341043
this.flush();
10351044
// Wait for completion of `flush`
1036-
poll-one(pollable);
1045+
pollable.block();
10371046
// Check for any errors that arose during `flush`
10381047
let _ = this.check-write(); // eliding error handling
10391048
</code></pre>
@@ -1084,7 +1093,7 @@ is ready for reading, before performing the <code>splice</code>.</p>
10841093
<ul>
10851094
<li><a name="method_output_stream.blocking_splice.0"></a> result&lt;<code>u64</code>, <a href="#stream_error"><a href="#stream_error"><code>stream-error</code></a></a>&gt;</li>
10861095
</ul>
1087-
<h2><a name="wasi:clocks_monotonic_clock_0.2.0_rc_2023_11_10">Import interface wasi:clocks/[email protected]-rc-2023-11-10</a></h2>
1096+
<h2><a name="wasi:clocks_monotonic_clock_0.2.0">Import interface wasi:clocks/[email protected]</a></h2>
10881097
<p>WASI Monotonic Clock is a clock API intended to let users measure elapsed
10891098
time.</p>
10901099
<p>It is intended to be portable at least between Unix-family platforms and
@@ -1145,7 +1154,7 @@ occured.</p>
11451154
<ul>
11461155
<li><a name="subscribe_duration.0"></a> own&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
11471156
</ul>
1148-
<h2><a name="wasi:sockets_tcp_0.2.0_rc_2024_01_16">Import interface wasi:sockets/[email protected]-rc-2024-01-16</a></h2>
1157+
<h2><a name="wasi:sockets_tcp_0.2.0">Import interface wasi:sockets/[email protected]</a></h2>
11491158
<hr />
11501159
<h3>Types</h3>
11511160
<h4><a name="input_stream"><code>type input-stream</code></a></h4>
@@ -1736,7 +1745,7 @@ has no effect and returns <code>ok</code>.</p>
17361745
<ul>
17371746
<li><a name="method_tcp_socket.shutdown.0"></a> result&lt;_, <a href="#error_code"><a href="#error_code"><code>error-code</code></a></a>&gt;</li>
17381747
</ul>
1739-
<h2><a name="wasi:sockets_tcp_create_socket_0.2.0_rc_2024_01_16">Import interface wasi:sockets/[email protected]-rc-2024-01-16</a></h2>
1748+
<h2><a name="wasi:sockets_tcp_create_socket_0.2.0">Import interface wasi:sockets/[email protected]</a></h2>
17401749
<hr />
17411750
<h3>Types</h3>
17421751
<h4><a name="network"><code>type network</code></a></h4>
@@ -1781,7 +1790,7 @@ is called, the socket is effectively an in-memory configuration object, unable t
17811790
<ul>
17821791
<li><a name="create_tcp_socket.0"></a> result&lt;own&lt;<a href="#tcp_socket"><a href="#tcp_socket"><code>tcp-socket</code></a></a>&gt;, <a href="#error_code"><a href="#error_code"><code>error-code</code></a></a>&gt;</li>
17831792
</ul>
1784-
<h2><a name="wasi:sockets_ip_name_lookup_0.2.0_rc_2024_01_16">Import interface wasi:sockets/[email protected]-rc-2024-01-16</a></h2>
1793+
<h2><a name="wasi:sockets_ip_name_lookup_0.2.0">Import interface wasi:sockets/[email protected]</a></h2>
17851794
<hr />
17861795
<h3>Types</h3>
17871796
<h4><a name="pollable"><code>type pollable</code></a></h4>

wit/deps.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[clocks]
22
url = "https://github.com/WebAssembly/wasi-clocks/archive/main.tar.gz"
3-
sha256 = "89da8eca4cd195516574c89c5b3c24a7b5af3ff2565c16753d20d3bdbc5fc60f"
4-
sha512 = "244079b3f592d58478a97adbd0bee8d49ae9dd1a3e435651ee40997b50da9fe62cfaba7e3ec7f7406d7d0288d278a43a3a0bc5150226ba40ce0f8ac6d33f7ddb"
3+
sha256 = "468b4d12892fe926b8eb5d398dbf579d566c93231fa44f415440572c695b7613"
4+
sha512 = "e6b53a07221f1413953c9797c68f08b815fdaebf66419bbc1ea3e8b7dece73731062693634731f311a03957b268cf9cc509c518bd15e513c318aa04a8459b93a"
55

66
[io]
77
url = "https://github.com/WebAssembly/wasi-io/archive/main.tar.gz"
8-
sha256 = "f2e6127b235c37c06be675a904d6acf08db953ea688d78c42892c6ad3bd194e4"
9-
sha512 = "32feefbc115c34bf6968cb6e9dc15e755698ee90648e5a5d84448917c36a318bd61b401195eb64330e2475e1d098bfb8dee1440d594a68e0797748762bd84ae5"
8+
sha256 = "7210e5653539a15478f894d4da24cc69d61924cbcba21d2804d69314a88e5a4c"
9+
sha512 = "49184a1b0945a889abd52d25271172ed3dc2db6968fcdddb1bab7ee0081f4a3eeee0977ad2291126a37631c0d86eeea75d822fa8af224c422134500bf9f0f2bb"

wit/deps/clocks/monotonic-clock.wit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package wasi:clocks@0.2.0-rc-2023-11-10;
1+
package wasi:clocks@0.2.0;
22
/// WASI Monotonic Clock is a clock API intended to let users measure elapsed
33
/// time.
44
///
@@ -10,7 +10,7 @@ package wasi:[email protected];
1010
///
1111
/// It is intended for measuring elapsed time.
1212
interface monotonic-clock {
13-
use wasi:io/poll@0.2.0-rc-2023-11-10.{pollable};
13+
use wasi:io/poll@0.2.0.{pollable};
1414

1515
/// An instant in time, in nanoseconds. An instant is relative to an
1616
/// unspecified initial value, and can only be compared to instances from

wit/deps/clocks/wall-clock.wit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package wasi:clocks@0.2.0-rc-2023-11-10;
1+
package wasi:clocks@0.2.0;
22
/// WASI Wall Clock is a clock API intended to let users query the current
33
/// time. The name "wall" makes an analogy to a "clock on the wall", which
44
/// is not necessarily monotonic as it may be reset.

wit/deps/clocks/world.wit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package wasi:clocks@0.2.0-rc-2023-11-10;
1+
package wasi:clocks@0.2.0;
22

33
world imports {
44
import monotonic-clock;

wit/deps/io/error.wit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package wasi:io@0.2.0-rc-2023-11-10;
1+
package wasi:io@0.2.0;
22

33

44
interface error {

wit/deps/io/poll.wit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package wasi:io@0.2.0-rc-2023-11-10;
1+
package wasi:io@0.2.0;
22

33
/// A poll API intended to let users wait for I/O events on multiple handles
44
/// at once.
55
interface poll {
6-
/// `pollable` epresents a single I/O event which may be ready, or not.
6+
/// `pollable` represents a single I/O event which may be ready, or not.
77
resource pollable {
88

99
/// Return the readiness of a pollable. This function never blocks.

wit/deps/io/streams.wit

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package wasi:io@0.2.0-rc-2023-11-10;
1+
package wasi:io@0.2.0;
22

33
/// WASI I/O is an I/O abstraction API which is currently focused on providing
44
/// stream types.
@@ -32,6 +32,11 @@ interface streams {
3232
resource input-stream {
3333
/// Perform a non-blocking read from the stream.
3434
///
35+
/// When the source of a `read` is binary data, the bytes from the source
36+
/// are returned verbatim. When the source of a `read` is known to the
37+
/// implementation to be text, bytes containing the UTF-8 encoding of the
38+
/// text are returned.
39+
///
3540
/// This function returns a list of bytes containing the read data,
3641
/// when successful. The returned list will contain up to `len` bytes;
3742
/// it may return fewer than requested, but not more. The list is
@@ -111,6 +116,12 @@ interface streams {
111116

112117
/// Perform a write. This function never blocks.
113118
///
119+
/// When the destination of a `write` is binary data, the bytes from
120+
/// `contents` are written verbatim. When the destination of a `write` is
121+
/// known to the implementation to be text, the bytes of `contents` are
122+
/// transcoded from UTF-8 into the encoding of the destination and then
123+
/// written.
124+
///
114125
/// Precondition: check-write gave permit of Ok(n) and contents has a
115126
/// length of less than or equal to n. Otherwise, this function will trap.
116127
///
@@ -131,7 +142,7 @@ interface streams {
131142
/// let pollable = this.subscribe();
132143
/// while !contents.is_empty() {
133144
/// // Wait for the stream to become writable
134-
/// poll-one(pollable);
145+
/// pollable.block();
135146
/// let Ok(n) = this.check-write(); // eliding error handling
136147
/// let len = min(n, contents.len());
137148
/// let (chunk, rest) = contents.split_at(len);
@@ -140,7 +151,7 @@ interface streams {
140151
/// }
141152
/// this.flush();
142153
/// // Wait for completion of `flush`
143-
/// poll-one(pollable);
154+
/// pollable.block();
144155
/// // Check for any errors that arose during `flush`
145156
/// let _ = this.check-write(); // eliding error handling
146157
/// ```
@@ -178,7 +189,7 @@ interface streams {
178189

179190
/// Write zeroes to a stream.
180191
///
181-
/// this should be used precisely like `write` with the exact same
192+
/// This should be used precisely like `write` with the exact same
182193
/// preconditions (must use check-write first), but instead of
183194
/// passing a list of bytes, you simply pass the number of zero-bytes
184195
/// that should be written.
@@ -199,15 +210,15 @@ interface streams {
199210
/// let pollable = this.subscribe();
200211
/// while num_zeroes != 0 {
201212
/// // Wait for the stream to become writable
202-
/// poll-one(pollable);
213+
/// pollable.block();
203214
/// let Ok(n) = this.check-write(); // eliding error handling
204215
/// let len = min(n, num_zeroes);
205216
/// this.write-zeroes(len); // eliding error handling
206217
/// num_zeroes -= len;
207218
/// }
208219
/// this.flush();
209220
/// // Wait for completion of `flush`
210-
/// poll-one(pollable);
221+
/// pollable.block();
211222
/// // Check for any errors that arose during `flush`
212223
/// let _ = this.check-write(); // eliding error handling
213224
/// ```

wit/deps/io/world.wit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package wasi:io@0.2.0-rc-2023-11-10;
1+
package wasi:io@0.2.0;
22

33
world imports {
44
import streams;

wit/ip-name-lookup.wit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
interface ip-name-lookup {
3-
use wasi:io/poll@0.2.0-rc-2023-11-10.{pollable};
3+
use wasi:io/poll@0.2.0.{pollable};
44
use network.{network, error-code, ip-address};
55

66

0 commit comments

Comments
 (0)