Skip to content

Commit

Permalink
Documentation fix (#59)
Browse files Browse the repository at this point in the history
* Update docs after #54

* Fix typo.
  • Loading branch information
badeend authored Nov 22, 2023
1 parent 765203a commit df7af5e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions imports.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ following pseudo-code:</p>
<pre><code class="language-text">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);
Expand All @@ -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
</code></pre>
Expand Down Expand Up @@ -300,7 +300,7 @@ all derived <a href="#pollable"><code>pollable</code></a>s created with this fun
</ul>
<h4><a name="method_output_stream.write_zeroes"><code>[method]output-stream.write-zeroes: func</code></a></h4>
<p>Write zeroes to a stream.</p>
<p>this should be used precisely like <code>write</code> with the exact same
<p>This should be used precisely like <code>write</code> 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.</p>
Expand All @@ -323,15 +323,15 @@ the following pseudo-code:</p>
<pre><code class="language-text">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
num_zeroes -= len;
}
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
</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion wit/poll.wit
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions wit/streams.wit
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
/// ```
Expand Down Expand Up @@ -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.
Expand All @@ -199,15 +199,15 @@ 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
/// num_zeroes -= len;
/// }
/// 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
/// ```
Expand Down

0 comments on commit df7af5e

Please sign in to comment.