22<ul >
33<li >Imports:
44<ul >
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 >
5+ <li >interface <a href =" #wasi_io_error_0_2_1 " ><code >wasi:io/error@0.2.1 </code ></a ></li >
6+ <li >interface <a href =" #wasi_io_poll_0_2_1 " ><code >wasi:io/poll@0.2.1 </code ></a ></li >
7+ <li >interface <a href =" #wasi_io_streams_0_2_1 " ><code >wasi:io/streams@0.2.1 </code ></a ></li >
8+ <li >interface <a href =" #wasi_clocks_wall_clock_0_2_1 " ><code >wasi:clocks/wall-clock@0.2.1 </code ></a ></li >
9+ <li >interface <a href =" #wasi_filesystem_types_0_2_1 " ><code >wasi:filesystem/types@0.2.1 </code ></a ></li >
10+ <li >interface <a href =" #wasi_filesystem_preopens_0_2_1 " ><code >wasi:filesystem/preopens@0.2.1 </code ></a ></li >
1111</ul >
1212</li >
1313</ul >
14- <h2 ><a name =" wasi_io_error_0_2_0 " ></a >Import interface wasi:io/error@0.2.0 </h2 >
14+ <h2 ><a name =" wasi_io_error_0_2_1 " ></a >Import interface wasi:io/error@0.2.1 </h2 >
1515<hr />
1616<h3 >Types</h3 >
1717<h4 ><a name =" error " ></a ><code >resource error</code ></h4 >
@@ -21,13 +21,11 @@ which provides some human-readable information about the error.</p>
2121<p >In the <code >wasi:io</code > package, this resource is returned through the
2222<code >wasi: io /streams/stream-error</code > type.</p >
2323<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 >
24+ offer functions to " ; downcast" ; this error into more specific types. For example,
25+ errors returned from streams derived from filesystem types can be described using
26+ the filesystem's own error-code type. This is done using the function
27+ <code >wasi: filesystem /types/filesystem-error-code</code >, which takes a <code >borrow< ; error> ; </code >
28+ parameter and returns an <code >option< ; wasi: filesystem /types/error-code> ; </code >.</p >
3129<h2 >The set of functions which can " ; downcast" ; an <a href =" #error " ><code >error</code ></a > into a more
3230concrete type is open.</h2 >
3331<h3 >Functions</h3 >
@@ -46,7 +44,7 @@ hazard.</p>
4644<ul >
4745<li ><a name =" method_error_to_debug_string.0 " ></a > <code >string</code ></li >
4846</ul >
49- <h2 ><a name =" wasi_io_poll_0_2_0 " ></a >Import interface wasi:io/poll@0.2.0 </h2 >
47+ <h2 ><a name =" wasi_io_poll_0_2_1 " ></a >Import interface wasi:io/poll@0.2.1 </h2 >
5048<p >A poll API intended to let users wait for I/O events on multiple handles
5149at once.</p >
5250<hr />
@@ -80,14 +78,17 @@ containing only this pollable.</p>
8078interest, and waits until one or more of the events is ready for I/O.</p >
8179<p >The result <code >list< ; u32> ; </code > contains one or more indices of handles in the
8280argument list that is ready for I/O.</p >
83- <p >If the list contains more elements than can be indexed with a <code >u32</code >
84- value, this function traps.</p >
81+ <p >This function traps if either:</p >
82+ <ul >
83+ <li >the list is empty, or:</li >
84+ <li >the list contains more elements than can be indexed with a <code >u32</code > value.</li >
85+ </ul >
8586<p >A timeout can be implemented by adding a pollable from the
8687wasi-clocks API to the list.</p >
8788<p >This function does not return a <code >result</code >; polling in itself does not
8889do any I/O so it doesn't fail. If any of the I/O sources identified by
8990the pollables has an error, it is indicated by marking the source as
90- being reaedy for I/O.</p >
91+ being ready for I/O.</p >
9192<h5 >Params</h5 >
9293<ul >
9394<li ><a name =" poll.in " ></a ><code >in</code >: list< ; borrow< ; <a href =" #pollable " ><a href =" #pollable " ><code >pollable</code ></a ></a >> ;> ; </li >
@@ -96,7 +97,7 @@ being reaedy for I/O.</p>
9697<ul >
9798<li ><a name =" poll.0 " ></a > list< ; <code >u32</code >> ; </li >
9899</ul >
99- <h2 ><a name =" wasi_io_streams_0_2_0 " ></a >Import interface wasi:io/streams@0.2.0 </h2 >
100+ <h2 ><a name =" wasi_io_streams_0_2_1 " ></a >Import interface wasi:io/streams@0.2.1 </h2 >
100101<p >WASI I/O is an I/O abstraction API which is currently focused on providing
101102stream types.</p >
102103<p >In the future, the component model is expected to add built-in stream types;
@@ -135,12 +136,15 @@ use the <code>subscribe</code> function to obtain a <a href="#pollable"><code>po
135136for using <code >wasi: io /poll</code >.</p >
136137<h4 ><a name =" output_stream " ></a ><code >resource output-stream</code ></h4 >
137138<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+ <p ><a href =" #output_stream " ><code >output-stream</code ></a >s are <em >non-blocking</em > to the extent practical on
139140underlying platforms. Except where specified otherwise, I/O operations also
140141always return promptly, after the number of bytes that can be written
141142promptly, which could even be zero. To wait for the stream to be ready to
142143accept 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 >
144+ polled for using <code >wasi: io /poll</code >.</p >
145+ <h2 >Dropping an <a href =" #output_stream " ><code >output-stream</code ></a > while there's still an active write in
146+ progress may result in the data being lost. Before dropping the stream,
147+ be sure to fully flush your writes.</h2 >
144148<h3 >Functions</h3 >
145149<h4 ><a name =" method_input_stream_read " ></a ><code >[method]input-stream.read: func</code ></h4 >
146150<p >Perform a non-blocking read from the stream.</p >
@@ -322,7 +326,7 @@ and stream is ready for writing again.</p>
322326</ul >
323327<h4 ><a name =" method_output_stream_subscribe " ></a ><code >[method]output-stream.subscribe: func</code ></h4 >
324328<p >Create a <a href =" #pollable " ><code >pollable</code ></a > which will resolve once the output-stream
325- is ready for more writing, or an error has occured . When this
329+ is ready for more writing, or an error has occurred . When this
326330pollable is ready, <code >check-write</code > will return <code >ok(n)</code > with n> ; 0, or an
327331error.</p >
328332<p >If the stream is closed, this pollable is always ready immediately.</p >
@@ -385,7 +389,7 @@ let _ = this.check-write(); // eliding error handling
385389</ul >
386390<h4 ><a name =" method_output_stream_splice " ></a ><code >[method]output-stream.splice: func</code ></h4 >
387391<p >Read from one stream and write to another.</p >
388- <p >The behavior of splice is equivelant to:</p >
392+ <p >The behavior of splice is equivalent to:</p >
389393<ol >
390394<li >calling <code >check-write</code > on the <a href =" #output_stream " ><code >output-stream</code ></a ></li >
391395<li >calling <code >read</code > on the <a href =" #input_stream " ><code >input-stream</code ></a > with the smaller of the
@@ -421,7 +425,7 @@ is ready for reading, before performing the <code>splice</code>.</p>
421425<ul >
422426<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 >
423427</ul >
424- <h2 ><a name =" wasi_clocks_wall_clock_0_2_0 " ></a >Import interface wasi:clocks/wall-clock@0.2.0 </h2 >
428+ <h2 ><a name =" wasi_clocks_wall_clock_0_2_1 " ></a >Import interface wasi:clocks/wall-clock@0.2.1 </h2 >
425429<p >WASI Wall Clock is a clock API intended to let users query the current
426430time. The name " ; wall" ; makes an analogy to a " ; clock on the wall" ; , which
427431is not necessarily monotonic as it may be reset.</p >
@@ -462,7 +466,7 @@ also known as <a href="https://en.wikipedia.org/wiki/Unix_time">Unix Time</a>.</
462466<ul >
463467<li ><a name =" resolution.0 " ></a > <a href =" #datetime " ><a href =" #datetime " ><code >datetime</code ></a ></a ></li >
464468</ul >
465- <h2 ><a name =" wasi_filesystem_types_0_2_0 " ></a >Import interface wasi:filesystem/types@0.2.0 </h2 >
469+ <h2 ><a name =" wasi_filesystem_types_0_2_1 " ></a >Import interface wasi:filesystem/types@0.2.1 </h2 >
466470<p >WASI filesystem is a filesystem API primarily intended to let users run WASI
467471programs that access their files on their existing filesystems, without
468472significant overhead.</p >
@@ -1342,7 +1346,7 @@ errors are filesystem-related errors.</p>
13421346<ul >
13431347<li ><a name =" filesystem_error_code.0 " ></a > option< ; <a href =" #error_code " ><a href =" #error_code " ><code >error-code</code ></a ></a >> ; </li >
13441348</ul >
1345- <h2 ><a name =" wasi_filesystem_preopens_0_2_0 " ></a >Import interface wasi:filesystem/preopens@0.2.0 </h2 >
1349+ <h2 ><a name =" wasi_filesystem_preopens_0_2_1 " ></a >Import interface wasi:filesystem/preopens@0.2.1 </h2 >
13461350<hr />
13471351<h3 >Types</h3 >
13481352<h4 ><a name =" descriptor " ></a ><code >type descriptor</code ></h4 >
0 commit comments