From b64958f7eb3d9895dae198082a18b406e70a01f5 Mon Sep 17 00:00:00 2001
From: Dave Bakker
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 pollable
s 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.