diff --git a/imports.md b/imports.md index f9a4f22..57fc87c 100644 --- a/imports.md +++ b/imports.md @@ -267,25 +267,13 @@ the last call to check-write provided a permit.

[method]output-stream.blocking-write-and-flush: func

Perform a write of up to 4096 bytes, and then flush the stream. Block until all of these operations are complete, or an error occurs.

-

This is a convenience wrapper around the use of check-write, -subscribe, write, and flush, and is implemented with the -following pseudo-code:

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

Returns success when all of the contents written are successfully +flushed to output. If an error occurs at any point before all +contents are successfully flushed, that error is returned as soon as +possible. If writing and flushing the complete contents causes the +stream to become closed, this call should return success, and +subsequent calls to check-write or other interfaces should return +stream-error::closed.

Params