From f4720c8ed646a57d4d019b808b9ed24119a7c982 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 7 Feb 2025 16:50:38 -0800 Subject: [PATCH 1/2] Revise the documentation for WASI 0.3.0's descriptor::read. Similar to WebAssembly/wasi-sockets#112, revise the description of `read` to clarify the relationship between the `stream` and the `future`. --- wit-0.3.0-draft/types.wit | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wit-0.3.0-draft/types.wit b/wit-0.3.0-draft/types.wit index af3cb25..c3b4a7b 100644 --- a/wit-0.3.0-draft/types.wit +++ b/wit-0.3.0-draft/types.wit @@ -297,8 +297,15 @@ interface types { /// Multiple read, write, and append streams may be active on the same open /// file and they do not interfere with each other. /// - /// This function returns a future, which will resolve to an error code if - /// reading full contents of the file fails. + /// This function returns a `stream` which provides the data received from the + /// file, and a `future` providing additional error information in case an + /// error is encountered. + /// + /// If no error is encountered, `stream.read` on the `stream` will return + /// `read-status::closed` with no `error-context` and the future resolves to + /// the value `ok`. If an error is encounttered, `stream.read` on the + /// `stream` returns `read-status::closed` with an `error-context` and the future + /// resolves to `err` with an `error-code`. /// /// Note: This is similar to `pread` in POSIX. @since(version = 0.3.0) From b8b9d1f9ae26062a00dd2d4ac2b7fb4213c068cc Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 21 Jul 2025 18:28:59 -0700 Subject: [PATCH 2/2] Update wit-0.3.0-draft/types.wit Co-authored-by: Bailey Hayes --- wit-0.3.0-draft/types.wit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wit-0.3.0-draft/types.wit b/wit-0.3.0-draft/types.wit index c3b4a7b..2387f87 100644 --- a/wit-0.3.0-draft/types.wit +++ b/wit-0.3.0-draft/types.wit @@ -303,7 +303,7 @@ interface types { /// /// If no error is encountered, `stream.read` on the `stream` will return /// `read-status::closed` with no `error-context` and the future resolves to - /// the value `ok`. If an error is encounttered, `stream.read` on the + /// the value `ok`. If an error is encountered, `stream.read` on the /// `stream` returns `read-status::closed` with an `error-context` and the future /// resolves to `err` with an `error-code`. ///