22<ul >
33<li >Imports:
44<ul >
5- <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 >
6- <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 >
7- <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 >
8- <li >interface <a href =" #wasi:clocks_wall_clock_0.2.0_rc_2023_11_10 " ><code >wasi:clocks/wall-clock@0.2.0-rc-2023-11-10 </code ></a ></li >
9- <li >interface <a href =" #wasi:filesystem_types_0.2.0_rc_2023_11_10 " ><code >wasi:filesystem/types@0.2.0-rc-2023-11-10 </code ></a ></li >
10- <li >interface <a href =" #wasi:filesystem_preopens_0.2.0_rc_2023_11_10 " ><code >wasi:filesystem/preopens@0.2.0-rc-2023-11-10 </code ></a ></li >
5+ <li >interface <a href =" #wasi:io_error_0.2.0 " ><code >wasi:io/error@0.2.0</code ></a ></li >
6+ <li >interface <a href =" #wasi:io_poll_0.2.0 " ><code >wasi:io/poll@0.2.0</code ></a ></li >
7+ <li >interface <a href =" #wasi:io_streams_0.2.0 " ><code >wasi:io/streams@0.2.0</code ></a ></li >
8+ <li >interface <a href =" #wasi:clocks_wall_clock_0.2.0 " ><code >wasi:clocks/wall-clock@0.2.0</code ></a ></li >
9+ <li >interface <a href =" #wasi:filesystem_types_0.2.0 " ><code >wasi:filesystem/types@0.2.0</code ></a ></li >
10+ <li >interface <a href =" #wasi:filesystem_preopens_0.2.0 " ><code >wasi:filesystem/preopens@0.2.0</code ></a ></li >
1111</ul >
1212</li >
1313</ul >
14- <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 >
14+ <h2 ><a name =" wasi:io_error_0.2.0 " >Import interface wasi:io/error@0.2.0</a ></h2 >
1515<hr />
1616<h3 >Types</h3 >
1717<h4 ><a name =" error " ><code >resource error</code ></a ></h4 >
18- <hr />
18+ <p >A resource which represents some error information.</p >
19+ <p >The only method provided by this resource is <code >to-debug-string</code >,
20+ which provides some human-readable information about the error.</p >
21+ <p >In the <code >wasi:io</code > package, this resource is returned through the
22+ <code >wasi: io /streams/stream-error</code > type.</p >
23+ <p >To provide more specific error information, other interfaces may
24+ provide functions to further " ; downcast" ; this error into more specific
25+ error information. For example, <a href =" #error " ><code >error</code ></a >s returned in streams derived
26+ from filesystem types to be described using the filesystem's own
27+ error-code type, using the function
28+ <code >wasi: filesystem /types/filesystem-error-code</code >, which takes a parameter
29+ <code >borrow< ; error> ; </code > and returns
30+ <code >option< ; wasi: filesystem /types/error-code> ; </code >.</p >
31+ <h2 >The set of functions which can " ; downcast" ; an <a href =" #error " ><code >error</code ></a > into a more
32+ concrete type is open.</h2 >
1933<h3 >Functions</h3 >
2034<h4 ><a name =" method_error.to_debug_string " ><code >[method]error.to-debug-string: func</code ></a ></h4 >
2135<p >Returns a string that is suitable to assist humans in debugging
@@ -32,13 +46,13 @@ hazard.</p>
3246<ul >
3347<li ><a name =" method_error.to_debug_string.0 " ></a > <code >string</code ></li >
3448</ul >
35- <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 >
49+ <h2 ><a name =" wasi:io_poll_0.2.0 " >Import interface wasi:io/poll@0.2.0</a ></h2 >
3650<p >A poll API intended to let users wait for I/O events on multiple handles
3751at once.</p >
3852<hr />
3953<h3 >Types</h3 >
4054<h4 ><a name =" pollable " ><code >resource pollable</code ></a ></h4 >
41- <hr / >
55+ <h2 >< a href = " #pollable " >< code >pollable</ code ></ a > represents a single I/O event which may be ready, or not.</ h2 >
4256<h3 >Functions</h3 >
4357<h4 ><a name =" method_pollable.ready " ><code >[method]pollable.ready: func</code ></a ></h4 >
4458<p >Return the readiness of a pollable. This function never blocks.</p >
@@ -82,7 +96,7 @@ being reaedy for I/O.</p>
8296<ul >
8397<li ><a name =" poll.0 " ></a > list< ; <code >u32</code >> ; </li >
8498</ul >
85- <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 >
99+ <h2 ><a name =" wasi:io_streams_0.2.0 " >Import interface wasi:io/streams@0.2.0</a ></h2 >
86100<p >WASI I/O is an I/O abstraction API which is currently focused on providing
87101stream types.</p >
88102<p >In the future, the component model is expected to add built-in stream types;
@@ -112,11 +126,28 @@ future operations.
112126</li >
113127</ul >
114128<h4 ><a name =" input_stream " ><code >resource input-stream</code ></a ></h4 >
129+ <p >An input bytestream.</p >
130+ <p ><a href =" #input_stream " ><code >input-stream</code ></a >s are <em >non-blocking</em > to the extent practical on underlying
131+ platforms. I/O operations always return promptly; if fewer bytes are
132+ promptly available than requested, they return the number of bytes promptly
133+ available, which could even be zero. To wait for data to be available,
134+ use the <code >subscribe</code > function to obtain a <a href =" #pollable " ><code >pollable</code ></a > which can be polled
135+ for using <code >wasi: io /poll</code >.</p >
115136<h4 ><a name =" output_stream " ><code >resource output-stream</code ></a ></h4 >
116- <hr />
137+ <p >An output bytestream.</p >
138+ <h2 ><a href =" #output_stream " ><code >output-stream</code ></a >s are <em >non-blocking</em > to the extent practical on
139+ underlying platforms. Except where specified otherwise, I/O operations also
140+ always return promptly, after the number of bytes that can be written
141+ promptly, which could even be zero. To wait for the stream to be ready to
142+ accept data, the <code >subscribe</code > function to obtain a <a href =" #pollable " ><code >pollable</code ></a > which can be
143+ polled for using <code >wasi: io /poll</code >.</h2 >
117144<h3 >Functions</h3 >
118145<h4 ><a name =" method_input_stream.read " ><code >[method]input-stream.read: func</code ></a ></h4 >
119146<p >Perform a non-blocking read from the stream.</p >
147+ <p >When the source of a <code >read</code > is binary data, the bytes from the source
148+ are returned verbatim. When the source of a <code >read</code > is known to the
149+ implementation to be text, bytes containing the UTF-8 encoding of the
150+ text are returned.</p >
120151<p >This function returns a list of bytes containing the read data,
121152when successful. The returned list will contain up to <code >len</code > bytes;
122153it may return fewer than requested, but not more. The list is
@@ -212,6 +243,11 @@ error.</p>
212243</ul >
213244<h4 ><a name =" method_output_stream.write " ><code >[method]output-stream.write: func</code ></a ></h4 >
214245<p >Perform a write. This function never blocks.</p >
246+ <p >When the destination of a <code >write</code > is binary data, the bytes from
247+ <code >contents</code > are written verbatim. When the destination of a <code >write</code > is
248+ known to the implementation to be text, the bytes of <code >contents</code > are
249+ transcoded from UTF-8 into the encoding of the destination and then
250+ written.</p >
215251<p >Precondition: check-write gave permit of Ok(n) and contents has a
216252length of less than or equal to n. Otherwise, this function will trap.</p >
217253<p >returns Err(closed) without writing if the stream has closed since
@@ -234,7 +270,7 @@ following pseudo-code:</p>
234270<pre ><code class =" language-text " >let pollable = this.subscribe();
235271while !contents.is_empty() {
236272 // Wait for the stream to become writable
237- poll-one( pollable);
273+ pollable.block( );
238274 let Ok(n) = this.check-write(); // eliding error handling
239275 let len = min(n, contents.len());
240276 let (chunk, rest) = contents.split_at(len);
@@ -243,7 +279,7 @@ while !contents.is_empty() {
243279}
244280this.flush();
245281// Wait for completion of `flush`
246- poll-one( pollable);
282+ pollable.block( );
247283// Check for any errors that arose during `flush`
248284let _ = this.check-write(); // eliding error handling
249285</code ></pre >
@@ -303,7 +339,7 @@ all derived <a href="#pollable"><code>pollable</code></a>s created with this fun
303339</ul >
304340<h4 ><a name =" method_output_stream.write_zeroes " ><code >[method]output-stream.write-zeroes: func</code ></a ></h4 >
305341<p >Write zeroes to a stream.</p >
306- <p >this should be used precisely like <code >write</code > with the exact same
342+ <p >This should be used precisely like <code >write</code > with the exact same
307343preconditions (must use check-write first), but instead of
308344passing a list of bytes, you simply pass the number of zero-bytes
309345that should be written.</p >
@@ -326,15 +362,15 @@ the following pseudo-code:</p>
326362<pre ><code class =" language-text " >let pollable = this.subscribe();
327363while num_zeroes != 0 {
328364 // Wait for the stream to become writable
329- poll-one( pollable);
365+ pollable.block( );
330366 let Ok(n) = this.check-write(); // eliding error handling
331367 let len = min(n, num_zeroes);
332368 this.write-zeroes(len); // eliding error handling
333369 num_zeroes -= len;
334370}
335371this.flush();
336372// Wait for completion of `flush`
337- poll-one( pollable);
373+ pollable.block( );
338374// Check for any errors that arose during `flush`
339375let _ = this.check-write(); // eliding error handling
340376</code ></pre >
@@ -385,7 +421,7 @@ is ready for reading, before performing the <code>splice</code>.</p>
385421<ul >
386422<li ><a name =" method_output_stream.blocking_splice.0 " ></a > result< ; <code >u64</code >, <a href =" #stream_error " ><a href =" #stream_error " ><code >stream-error</code ></a ></a >> ; </li >
387423</ul >
388- <h2 ><a name =" wasi:clocks_wall_clock_0.2.0_rc_2023_11_10 " >Import interface wasi:clocks/wall-clock@0.2.0-rc-2023-11-10 </a ></h2 >
424+ <h2 ><a name =" wasi:clocks_wall_clock_0.2.0 " >Import interface wasi:clocks/wall-clock@0.2.0</a ></h2 >
389425<p >WASI Wall Clock is a clock API intended to let users query the current
390426time. The name " ; wall" ; makes an analogy to a " ; clock on the wall" ; , which
391427is not necessarily monotonic as it may be reset.</p >
@@ -426,7 +462,7 @@ also known as <a href="https://en.wikipedia.org/wiki/Unix_time">Unix Time</a>.</
426462<ul >
427463<li ><a name =" resolution.0 " ></a > <a href =" #datetime " ><a href =" #datetime " ><code >datetime</code ></a ></a ></li >
428464</ul >
429- <h2 ><a name =" wasi:filesystem_types_0.2.0_rc_2023_11_10 " >Import interface wasi:filesystem/types@0.2.0-rc-2023-11-10 </a ></h2 >
465+ <h2 ><a name =" wasi:filesystem_types_0.2.0 " >Import interface wasi:filesystem/types@0.2.0</a ></h2 >
430466<p >WASI filesystem is a filesystem API primarily intended to let users run WASI
431467programs that access their files on their existing filesystems, without
432468significant overhead.</p >
@@ -856,8 +892,11 @@ not reuse it thereafter.
856892</li >
857893</ul >
858894<h4 ><a name =" descriptor " ><code >resource descriptor</code ></a ></h4 >
895+ <p >A descriptor is a reference to a filesystem object, which may be a file,
896+ directory, named pipe, special file, or other object on which filesystem
897+ calls may be made.</p >
859898<h4 ><a name =" directory_entry_stream " ><code >resource directory-entry-stream</code ></a ></h4 >
860- <hr / >
899+ <h2 >A stream of directory entries.</ h2 >
861900<h3 >Functions</h3 >
862901<h4 ><a name =" method_descriptor.read_via_stream " ><code >[method]descriptor.read-via-stream: func</code ></a ></h4 >
863902<p >Return a stream for reading from a file, if available.</p >
@@ -1303,7 +1342,7 @@ errors are filesystem-related errors.</p>
13031342<ul >
13041343<li ><a name =" filesystem_error_code.0 " ></a > option< ; <a href =" #error_code " ><a href =" #error_code " ><code >error-code</code ></a ></a >> ; </li >
13051344</ul >
1306- <h2 ><a name =" wasi:filesystem_preopens_0.2.0_rc_2023_11_10 " >Import interface wasi:filesystem/preopens@0.2.0-rc-2023-11-10 </a ></h2 >
1345+ <h2 ><a name =" wasi:filesystem_preopens_0.2.0 " >Import interface wasi:filesystem/preopens@0.2.0</a ></h2 >
13071346<hr />
13081347<h3 >Types</h3 >
13091348<h4 ><a name =" descriptor " ><code >type descriptor</code ></a ></h4 >
0 commit comments