@@ -23,51 +23,6 @@ so at this time some features or planned features in the component model are
23
23
not ready for use in WASI APIs. Here's a list of those features and what to use
24
24
for now in their place.
25
25
26
- ### Resources
27
-
28
- Resources are expected to be available in time for Preview2, but at this time
29
- still in development.
30
-
31
- As a temporary workaround, WASI proposals are using ` u32 ` types, which
32
- represent indices into an implied global table of handles. Since it is
33
- implied and global, this table doesn't provide any isolation between
34
- components; it intended to be a temporary workaround to support prototyping.
35
-
36
- In place of a resource like this:
37
-
38
- ``` wit
39
- /// An example resource.
40
- ///
41
- /// A description of the example resource.
42
- resource resource-name {
43
- /// An example function.
44
- ///
45
- /// A description of the example function.
46
- function-name: func()
47
- }
48
- ```
49
-
50
- Define a ` u32 ` type alias, an explicit ` drop ` function, and change all
51
- functions inside the resource to have an explicit ` this ` argument, like this:
52
-
53
- ``` wit
54
- /// An example resource.
55
- ///
56
- /// A description of the example resource.
57
- ///
58
- /// This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources).
59
- type resource-name = 32
60
-
61
- /// An example function.
62
- ///
63
- /// A description of the example function.
64
- function-name: func(this: resource-name)
65
-
66
- /// Dispose of the specified `resource-name`, after which it may no longer
67
- /// be used.
68
- drop-resource-name: func(this: resource-name)
69
- ```
70
-
71
26
### Streams
72
27
73
28
Streams are expected to be available in the Preview 3 timeframe, as part of the
@@ -85,15 +40,14 @@ with a function returning `option<T>` or `result<option<T>, E>` for returning
85
40
the elements with ` none ` indicating the end of the stream.
86
41
87
42
This resource-based workaround can be used for asynchronous I/O by using
88
- [ wasi-poll ] to poll for multiple streams, however it doesn't support
43
+ [ wasi-io ] to poll for multiple streams, however it doesn't support
89
44
composing asynchronous work across multiple components, and it has some scaling
90
45
limitations. These limitations will be fixed when built in ` stream ` types are
91
46
available.
92
47
93
48
[ Component Model async proposal ] : https://docs.google.com/presentation/d/1MNVOZ8hdofO3tI0szg_i-Yoy0N2QPU2C--LzVuoGSlE/edit#slide=id.g1270ef7d5b6_0_662
94
49
[ use ] : #Dependencies
95
50
[ wasi-io ] : https://github.com/WebAssembly/wasi-io
96
- [ wasi-poll ] : https://github.com/WebAssembly/wasi-poll
97
51
[ resource ] : #Resources
98
52
99
53
### Value Imports
0 commit comments