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

Commit 55360a5

Browse files
author
Pat Hickey
committed
update markdown
1 parent 5d44447 commit 55360a5

File tree

1 file changed

+37
-28
lines changed

1 file changed

+37
-28
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/network@0.2.0-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/instance-network@0.2.0-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/poll@0.2.0-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/udp@0.2.0-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/udp-create-socket@0.2.0-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/error@0.2.0-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/streams@0.2.0-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/monotonic-clock@0.2.0-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/tcp@0.2.0-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/tcp-create-socket@0.2.0-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/ip-name-lookup@0.2.0-rc-2024-01-16</code></a></li>
5+
<li>interface <a href="#wasi:sockets_network_0.2.0"><code>wasi:sockets/network@0.2.0</code></a></li>
6+
<li>interface <a href="#wasi:sockets_instance_network_0.2.0"><code>wasi:sockets/instance-network@0.2.0</code></a></li>
7+
<li>interface <a href="#wasi:io_poll_0.2.0"><code>wasi:io/poll@0.2.0</code></a></li>
8+
<li>interface <a href="#wasi:sockets_udp_0.2.0"><code>wasi:sockets/udp@0.2.0</code></a></li>
9+
<li>interface <a href="#wasi:sockets_udp_create_socket_0.2.0"><code>wasi:sockets/udp-create-socket@0.2.0</code></a></li>
10+
<li>interface <a href="#wasi:io_error_0.2.0"><code>wasi:io/error@0.2.0</code></a></li>
11+
<li>interface <a href="#wasi:io_streams_0.2.0"><code>wasi:io/streams@0.2.0</code></a></li>
12+
<li>interface <a href="#wasi:clocks_monotonic_clock_0.2.0"><code>wasi:clocks/monotonic-clock@0.2.0</code></a></li>
13+
<li>interface <a href="#wasi:sockets_tcp_0.2.0"><code>wasi:sockets/tcp@0.2.0</code></a></li>
14+
<li>interface <a href="#wasi:sockets_tcp_create_socket_0.2.0"><code>wasi:sockets/tcp-create-socket@0.2.0</code></a></li>
15+
<li>interface <a href="#wasi:sockets_ip_name_lookup_0.2.0"><code>wasi:sockets/ip-name-lookup@0.2.0</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/network@0.2.0-rc-2024-01-16</a></h2>
19+
<h2><a name="wasi:sockets_network_0.2.0">Import interface wasi:sockets/network@0.2.0</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/instance-network@0.2.0-rc-2024-01-16</a></h2>
212+
<h2><a name="wasi:sockets_instance_network_0.2.0">Import interface wasi:sockets/instance-network@0.2.0</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/poll@0.2.0-rc-2023-11-10</a></h2>
227+
<h2><a name="wasi:io_poll_0.2.0">Import interface wasi:io/poll@0.2.0</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/udp@0.2.0-rc-2024-01-16</a></h2>
277+
<h2><a name="wasi:sockets_udp_0.2.0">Import interface wasi:sockets/udp@0.2.0</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/udp-create-socket@0.2.0-rc-2024-01-16</a></h2>
691+
<h2><a name="wasi:sockets_udp_create_socket_0.2.0">Import interface wasi:sockets/udp-create-socket@0.2.0</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/error@0.2.0-rc-2023-11-10</a></h2>
736+
<h2><a name="wasi:io_error_0.2.0">Import interface wasi:io/error@0.2.0</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/streams@0.2.0-rc-2023-11-10</a></h2>
771+
<h2><a name="wasi:io_streams_0.2.0">Import interface wasi:io/streams@0.2.0</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/monotonic-clock@0.2.0-rc-2023-11-10</a></h2>
1096+
<h2><a name="wasi:clocks_monotonic_clock_0.2.0">Import interface wasi:clocks/monotonic-clock@0.2.0</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/tcp@0.2.0-rc-2024-01-16</a></h2>
1157+
<h2><a name="wasi:sockets_tcp_0.2.0">Import interface wasi:sockets/tcp@0.2.0</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/tcp-create-socket@0.2.0-rc-2024-01-16</a></h2>
1748+
<h2><a name="wasi:sockets_tcp_create_socket_0.2.0">Import interface wasi:sockets/tcp-create-socket@0.2.0</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/ip-name-lookup@0.2.0-rc-2024-01-16</a></h2>
1793+
<h2><a name="wasi:sockets_ip_name_lookup_0.2.0">Import interface wasi:sockets/ip-name-lookup@0.2.0</a></h2>
17851794
<hr />
17861795
<h3>Types</h3>
17871796
<h4><a name="pollable"><code>type pollable</code></a></h4>

0 commit comments

Comments
 (0)