|
1 | | -package wasi:io@0.2.5; |
| 1 | +package wasi:io@0.2.7; |
2 | 2 |
|
3 | 3 | /// WASI I/O is an I/O abstraction API which is currently focused on providing |
4 | 4 | /// stream types. |
@@ -154,27 +154,13 @@ interface streams { |
154 | 154 | /// Perform a write of up to 4096 bytes, and then flush the stream. Block |
155 | 155 | /// until all of these operations are complete, or an error occurs. |
156 | 156 | /// |
157 | | - /// This is a convenience wrapper around the use of `check-write`, |
158 | | - /// `subscribe`, `write`, and `flush`, and is implemented with the |
159 | | - /// following pseudo-code: |
160 | | - /// |
161 | | - /// ```text |
162 | | - /// let pollable = this.subscribe(); |
163 | | - /// while !contents.is_empty() { |
164 | | - /// // Wait for the stream to become writable |
165 | | - /// pollable.block(); |
166 | | - /// let Ok(n) = this.check-write(); // eliding error handling |
167 | | - /// let len = min(n, contents.len()); |
168 | | - /// let (chunk, rest) = contents.split_at(len); |
169 | | - /// this.write(chunk ); // eliding error handling |
170 | | - /// contents = rest; |
171 | | - /// } |
172 | | - /// this.flush(); |
173 | | - /// // Wait for completion of `flush` |
174 | | - /// pollable.block(); |
175 | | - /// // Check for any errors that arose during `flush` |
176 | | - /// let _ = this.check-write(); // eliding error handling |
177 | | - /// ``` |
| 157 | + /// Returns success when all of the contents written are successfully |
| 158 | + /// flushed to output. If an error occurs at any point before all |
| 159 | + /// contents are successfully flushed, that error is returned as soon as |
| 160 | + /// possible. If writing and flushing the complete contents causes the |
| 161 | + /// stream to become closed, this call should return success, and |
| 162 | + /// subsequent calls to check-write or other interfaces should return |
| 163 | + /// stream-error::closed. |
178 | 164 | @since(version = 0.2.0) |
179 | 165 | blocking-write-and-flush: func( |
180 | 166 | contents: list<u8> |
@@ -227,26 +213,8 @@ interface streams { |
227 | 213 | /// Block until all of these operations are complete, or an error |
228 | 214 | /// occurs. |
229 | 215 | /// |
230 | | - /// This is a convenience wrapper around the use of `check-write`, |
231 | | - /// `subscribe`, `write-zeroes`, and `flush`, and is implemented with |
232 | | - /// the following pseudo-code: |
233 | | - /// |
234 | | - /// ```text |
235 | | - /// let pollable = this.subscribe(); |
236 | | - /// while num_zeroes != 0 { |
237 | | - /// // Wait for the stream to become writable |
238 | | - /// pollable.block(); |
239 | | - /// let Ok(n) = this.check-write(); // eliding error handling |
240 | | - /// let len = min(n, num_zeroes); |
241 | | - /// this.write-zeroes(len); // eliding error handling |
242 | | - /// num_zeroes -= len; |
243 | | - /// } |
244 | | - /// this.flush(); |
245 | | - /// // Wait for completion of `flush` |
246 | | - /// pollable.block(); |
247 | | - /// // Check for any errors that arose during `flush` |
248 | | - /// let _ = this.check-write(); // eliding error handling |
249 | | - /// ``` |
| 216 | + /// Functionality is equivelant to `blocking-write-and-flush` with |
| 217 | + /// contents given as a list of len containing only zeroes. |
250 | 218 | @since(version = 0.2.0) |
251 | 219 | blocking-write-zeroes-and-flush: func( |
252 | 220 | /// The number of zero-bytes to write |
|
0 commit comments