From b64958f7eb3d9895dae198082a18b406e70a01f5 Mon Sep 17 00:00:00 2001 From: Dave Bakker Date: Wed, 22 Nov 2023 10:30:38 +0100 Subject: [PATCH 1/2] Update docs after https://github.com/WebAssembly/wasi-io/pull/54 --- imports.md | 8 ++++---- wit/streams.wit | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/imports.md b/imports.md index 6900a88..d403535 100644 --- a/imports.md +++ b/imports.md @@ -231,7 +231,7 @@ following pseudo-code:

let pollable = this.subscribe();
 while !contents.is_empty() {
   // Wait for the stream to become writable
-  poll-one(pollable);
+  pollable.block();
   let Ok(n) = this.check-write(); // eliding error handling
   let len = min(n, contents.len());
   let (chunk, rest) = contents.split_at(len);
@@ -240,7 +240,7 @@ while !contents.is_empty() {
 }
 this.flush();
 // Wait for completion of `flush`
-poll-one(pollable);
+pollable.block();
 // Check for any errors that arose during `flush`
 let _ = this.check-write();         // eliding error handling
 
@@ -323,7 +323,7 @@ the following pseudo-code:

let pollable = this.subscribe();
 while num_zeroes != 0 {
   // Wait for the stream to become writable
-  poll-one(pollable);
+  pollable.block();
   let Ok(n) = this.check-write(); // eliding error handling
   let len = min(n, num_zeroes);
   this.write-zeroes(len);         // eliding error handling
@@ -331,7 +331,7 @@ while num_zeroes != 0 {
 }
 this.flush();
 // Wait for completion of `flush`
-poll-one(pollable);
+pollable.block();
 // Check for any errors that arose during `flush`
 let _ = this.check-write();         // eliding error handling
 
diff --git a/wit/streams.wit b/wit/streams.wit index e7e1b68..e9a30f8 100644 --- a/wit/streams.wit +++ b/wit/streams.wit @@ -131,7 +131,7 @@ interface streams { /// let pollable = this.subscribe(); /// while !contents.is_empty() { /// // Wait for the stream to become writable - /// poll-one(pollable); + /// pollable.block(); /// let Ok(n) = this.check-write(); // eliding error handling /// let len = min(n, contents.len()); /// let (chunk, rest) = contents.split_at(len); @@ -140,7 +140,7 @@ interface streams { /// } /// this.flush(); /// // Wait for completion of `flush` - /// poll-one(pollable); + /// pollable.block(); /// // Check for any errors that arose during `flush` /// let _ = this.check-write(); // eliding error handling /// ``` @@ -199,7 +199,7 @@ interface streams { /// let pollable = this.subscribe(); /// while num_zeroes != 0 { /// // Wait for the stream to become writable - /// poll-one(pollable); + /// pollable.block(); /// let Ok(n) = this.check-write(); // eliding error handling /// let len = min(n, num_zeroes); /// this.write-zeroes(len); // eliding error handling @@ -207,7 +207,7 @@ interface streams { /// } /// this.flush(); /// // Wait for completion of `flush` - /// poll-one(pollable); + /// pollable.block(); /// // Check for any errors that arose during `flush` /// let _ = this.check-write(); // eliding error handling /// ``` From cf45cce01371a3af21cbc1d1ac10c7907a6dcee3 Mon Sep 17 00:00:00 2001 From: Dave Bakker Date: Wed, 22 Nov 2023 11:02:09 +0100 Subject: [PATCH 2/2] Fix typo. --- imports.md | 2 +- wit/poll.wit | 2 +- wit/streams.wit | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/imports.md b/imports.md index d403535..55647e8 100644 --- a/imports.md +++ b/imports.md @@ -300,7 +300,7 @@ all derived pollables created with this fun

[method]output-stream.write-zeroes: func

Write zeroes to a stream.

-

this should be used precisely like write with the exact same +

This should be used precisely like write with the exact same preconditions (must use check-write first), but instead of passing a list of bytes, you simply pass the number of zero-bytes that should be written.

diff --git a/wit/poll.wit b/wit/poll.wit index bddde3c..81b1cab 100644 --- a/wit/poll.wit +++ b/wit/poll.wit @@ -3,7 +3,7 @@ package wasi:io@0.2.0-rc-2023-11-10; /// A poll API intended to let users wait for I/O events on multiple handles /// at once. interface poll { - /// `pollable` epresents a single I/O event which may be ready, or not. + /// `pollable` represents a single I/O event which may be ready, or not. resource pollable { /// Return the readiness of a pollable. This function never blocks. diff --git a/wit/streams.wit b/wit/streams.wit index e9a30f8..f6f7fe0 100644 --- a/wit/streams.wit +++ b/wit/streams.wit @@ -178,7 +178,7 @@ interface streams { /// Write zeroes to a stream. /// - /// this should be used precisely like `write` with the exact same + /// This should be used precisely like `write` with the exact same /// preconditions (must use check-write first), but instead of /// passing a list of bytes, you simply pass the number of zero-bytes /// that should be written.