Skip to content

Commit 930914d

Browse files
yoshuawuytsricochet
authored andcommitted
Update to v0.2.1
1 parent fe0ebbc commit 930914d

File tree

14 files changed

+171
-62
lines changed

14 files changed

+171
-62
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ jobs:
1919
git add -N wit/deps
2020
git diff --exit-code
2121
- uses: WebAssembly/wit-abi-up-to-date@v21
22+
with:
23+
wit-bindgen: '0.28.0'

imports.md

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
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 &quot;downcast&quot; 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&lt;error&gt;</code> and returns
30-
<code>option&lt;wasi:filesystem/types/error-code&gt;</code>.</p>
24+
offer functions to &quot;downcast&quot; 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&lt;error&gt;</code>
28+
parameter and returns an <code>option&lt;wasi:filesystem/types/error-code&gt;</code>.</p>
3129
<h2>The set of functions which can &quot;downcast&quot; an <a href="#error"><code>error</code></a> into a more
3230
concrete 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
5149
at once.</p>
5250
<hr />
@@ -80,14 +78,17 @@ containing only this pollable.</p>
8078
interest, and waits until one or more of the events is ready for I/O.</p>
8179
<p>The result <code>list&lt;u32&gt;</code> contains one or more indices of handles in the
8280
argument 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
8687
wasi-clocks API to the list.</p>
8788
<p>This function does not return a <code>result</code>; polling in itself does not
8889
do any I/O so it doesn't fail. If any of the I/O sources identified by
8990
the 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&lt;borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;&gt;</li>
@@ -96,7 +97,7 @@ being reaedy for I/O.</p>
9697
<ul>
9798
<li><a name="poll.0"></a> list&lt;<code>u32</code>&gt;</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
101102
stream 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
135136
for 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
139140
underlying platforms. Except where specified otherwise, I/O operations also
140141
always return promptly, after the number of bytes that can be written
141142
promptly, which could even be zero. To wait for the stream to be ready to
142143
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>
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
326330
pollable is ready, <code>check-write</code> will return <code>ok(n)</code> with n&gt;0, or an
327331
error.</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&lt;<code>u64</code>, <a href="#stream_error"><a href="#stream_error"><code>stream-error</code></a></a>&gt;</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
426430
time. The name &quot;wall&quot; makes an analogy to a &quot;clock on the wall&quot;, which
427431
is 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
467471
programs that access their files on their existing filesystems, without
468472
significant overhead.</p>
@@ -1342,7 +1346,7 @@ errors are filesystem-related errors.</p>
13421346
<ul>
13431347
<li><a name="filesystem_error_code.0"></a> option&lt;<a href="#error_code"><a href="#error_code"><code>error-code</code></a></a>&gt;</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>

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 = "468b4d12892fe926b8eb5d398dbf579d566c93231fa44f415440572c695b7613"
4-
sha512 = "e6b53a07221f1413953c9797c68f08b815fdaebf66419bbc1ea3e8b7dece73731062693634731f311a03957b268cf9cc509c518bd15e513c318aa04a8459b93a"
3+
sha256 = "ea9d69ee803bc176e23e5268f5e24a2ac485dd1f62a0ab4c748e9d3f901f576f"
4+
sha512 = "5efc22927c46cd56c41e5549ec775561c7fac2ea0d365abc0b55396d9475a7c9f984077a81f84a44a726f1c008fd2fadbffffa4fa53ecd5fbfd05afd379ab428"
55

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

wit/deps/clocks/monotonic-clock.wit

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package wasi:clocks@0.2.0;
1+
package wasi:clocks@0.2.1;
22
/// WASI Monotonic Clock is a clock API intended to let users measure elapsed
33
/// time.
44
///
@@ -7,38 +7,43 @@ package wasi:clocks@0.2.0;
77
///
88
/// A monotonic clock is a clock which has an unspecified initial value, and
99
/// successive reads of the clock will produce non-decreasing values.
10-
///
11-
/// It is intended for measuring elapsed time.
10+
@since(version = 0.2.0)
1211
interface monotonic-clock {
13-
use wasi:io/poll@0.2.0.{pollable};
12+
@since(version = 0.2.0)
13+
use wasi:io/poll@0.2.1.{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
1717
/// the same monotonic-clock.
18+
@since(version = 0.2.0)
1819
type instant = u64;
1920

2021
/// A duration of time, in nanoseconds.
22+
@since(version = 0.2.0)
2123
type duration = u64;
2224

2325
/// Read the current value of the clock.
2426
///
2527
/// The clock is monotonic, therefore calling this function repeatedly will
2628
/// produce a sequence of non-decreasing values.
29+
@since(version = 0.2.0)
2730
now: func() -> instant;
2831

2932
/// Query the resolution of the clock. Returns the duration of time
3033
/// corresponding to a clock tick.
34+
@since(version = 0.2.0)
3135
resolution: func() -> duration;
3236

3337
/// Create a `pollable` which will resolve once the specified instant
34-
/// occured.
38+
/// has occurred.
39+
@since(version = 0.2.0)
3540
subscribe-instant: func(
3641
when: instant,
3742
) -> pollable;
3843

39-
/// Create a `pollable` which will resolve once the given duration has
40-
/// elapsed, starting at the time at which this function was called.
41-
/// occured.
44+
/// Create a `pollable` that will resolve after the specified duration has
45+
/// elapsed from the time this function is invoked.
46+
@since(version = 0.2.0)
4247
subscribe-duration: func(
4348
when: duration,
4449
) -> pollable;

wit/deps/clocks/timezone.wit

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package wasi:clocks@0.2.1;
2+
3+
@unstable(feature = clocks-timezone)
4+
interface timezone {
5+
@unstable(feature = clocks-timezone)
6+
use wall-clock.{datetime};
7+
8+
/// Return information needed to display the given `datetime`. This includes
9+
/// the UTC offset, the time zone name, and a flag indicating whether
10+
/// daylight saving time is active.
11+
///
12+
/// If the timezone cannot be determined for the given `datetime`, return a
13+
/// `timezone-display` for `UTC` with a `utc-offset` of 0 and no daylight
14+
/// saving time.
15+
@unstable(feature = clocks-timezone)
16+
display: func(when: datetime) -> timezone-display;
17+
18+
/// The same as `display`, but only return the UTC offset.
19+
@unstable(feature = clocks-timezone)
20+
utc-offset: func(when: datetime) -> s32;
21+
22+
/// Information useful for displaying the timezone of a specific `datetime`.
23+
///
24+
/// This information may vary within a single `timezone` to reflect daylight
25+
/// saving time adjustments.
26+
@unstable(feature = clocks-timezone)
27+
record timezone-display {
28+
/// The number of seconds difference between UTC time and the local
29+
/// time of the timezone.
30+
///
31+
/// The returned value will always be less than 86400 which is the
32+
/// number of seconds in a day (24*60*60).
33+
///
34+
/// In implementations that do not expose an actual time zone, this
35+
/// should return 0.
36+
utc-offset: s32,
37+
38+
/// The abbreviated name of the timezone to display to a user. The name
39+
/// `UTC` indicates Coordinated Universal Time. Otherwise, this should
40+
/// reference local standards for the name of the time zone.
41+
///
42+
/// In implementations that do not expose an actual time zone, this
43+
/// should be the string `UTC`.
44+
///
45+
/// In time zones that do not have an applicable name, a formatted
46+
/// representation of the UTC offset may be returned, such as `-04:00`.
47+
name: string,
48+
49+
/// Whether daylight saving time is active.
50+
///
51+
/// In implementations that do not expose an actual time zone, this
52+
/// should return false.
53+
in-daylight-saving-time: bool,
54+
}
55+
}

wit/deps/clocks/wall-clock.wit

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package wasi:clocks@0.2.0;
1+
package wasi:clocks@0.2.1;
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.
@@ -13,8 +13,10 @@ package wasi:clocks@0.2.0;
1313
/// monotonic, making it unsuitable for measuring elapsed time.
1414
///
1515
/// It is intended for reporting the current date and time for humans.
16+
@since(version = 0.2.0)
1617
interface wall-clock {
1718
/// A time and date in seconds plus nanoseconds.
19+
@since(version = 0.2.0)
1820
record datetime {
1921
seconds: u64,
2022
nanoseconds: u32,
@@ -33,10 +35,12 @@ interface wall-clock {
3335
///
3436
/// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
3537
/// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
38+
@since(version = 0.2.0)
3639
now: func() -> datetime;
3740

3841
/// Query the resolution of the clock.
3942
///
4043
/// The nanoseconds field of the output is always less than 1000000000.
44+
@since(version = 0.2.0)
4145
resolution: func() -> datetime;
4246
}

wit/deps/clocks/world.wit

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
package wasi:clocks@0.2.0;
1+
package wasi:clocks@0.2.1;
22

3+
@since(version = 0.2.0)
34
world imports {
5+
@since(version = 0.2.0)
46
import monotonic-clock;
7+
@since(version = 0.2.0)
58
import wall-clock;
9+
@unstable(feature = clocks-timezone)
10+
import timezone;
611
}

wit/deps/io/error.wit

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package wasi:io@0.2.0;
2-
1+
package wasi:io@0.2.1;
32

3+
@since(version = 0.2.0)
44
interface error {
55
/// A resource which represents some error information.
66
///
@@ -11,16 +11,15 @@ interface error {
1111
/// `wasi:io/streams/stream-error` type.
1212
///
1313
/// To provide more specific error information, other interfaces may
14-
/// provide functions to further "downcast" this error into more specific
15-
/// error information. For example, `error`s returned in streams derived
16-
/// from filesystem types to be described using the filesystem's own
17-
/// error-code type, using the function
18-
/// `wasi:filesystem/types/filesystem-error-code`, which takes a parameter
19-
/// `borrow<error>` and returns
20-
/// `option<wasi:filesystem/types/error-code>`.
14+
/// offer functions to "downcast" this error into more specific types. For example,
15+
/// errors returned from streams derived from filesystem types can be described using
16+
/// the filesystem's own error-code type. This is done using the function
17+
/// `wasi:filesystem/types/filesystem-error-code`, which takes a `borrow<error>`
18+
/// parameter and returns an `option<wasi:filesystem/types/error-code>`.
2119
///
2220
/// The set of functions which can "downcast" an `error` into a more
2321
/// concrete type is open.
22+
@since(version = 0.2.0)
2423
resource error {
2524
/// Returns a string that is suitable to assist humans in debugging
2625
/// this error.
@@ -29,6 +28,7 @@ interface error {
2928
/// It may change across platforms, hosts, or other implementation
3029
/// details. Parsing this string is a major platform-compatibility
3130
/// hazard.
31+
@since(version = 0.2.0)
3232
to-debug-string: func() -> string;
3333
}
3434
}

0 commit comments

Comments
 (0)