Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion imports.md
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,9 @@ is ready for reading, before performing the <code>splice</code>.</p>
#### <a id="pollable"></a>`type pollable`
[`pollable`](#pollable)
<p>
#### <a id="io_error"></a>`type io-error`
[`error`](#error)
<p>
#### <a id="client_handshake"></a>`resource client-handshake`
<h4><a id="client_connection"></a><code>resource client-connection</code></h4>
<h4><a id="future_client_streams"></a><code>resource future-client-streams</code></h4>
Expand Down Expand Up @@ -483,5 +486,5 @@ is ready for reading, before performing the <code>splice</code>.</p>
</ul>
<h5>Return values</h5>
<ul>
<li><a id="method_future_client_streams_get.0"></a> option&lt;result&lt;result&lt;(own&lt;<a href="#client_connection"><a href="#client_connection"><code>client-connection</code></a></a>&gt;, own&lt;<a href="#input_stream"><a href="#input_stream"><code>input-stream</code></a></a>&gt;, own&lt;<a href="#output_stream"><a href="#output_stream"><code>output-stream</code></a></a>&gt;)&gt;&gt;&gt;</li>
<li><a id="method_future_client_streams_get.0"></a> option&lt;result&lt;result&lt;(own&lt;<a href="#client_connection"><a href="#client_connection"><code>client-connection</code></a></a>&gt;, own&lt;<a href="#input_stream"><a href="#input_stream"><code>input-stream</code></a></a>&gt;, own&lt;<a href="#output_stream"><a href="#output_stream"><code>output-stream</code></a></a>&gt;), own&lt;<a href="#io_error"><a href="#io_error"><code>io-error</code></a></a>&gt;&gt;&gt;&gt;</li>
</ul>
4 changes: 3 additions & 1 deletion wit/types.wit
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ interface types {
use wasi:io/streams@0.2.3.{input-stream, output-stream};
@unstable(feature = tls)
use wasi:io/poll@0.2.3.{pollable};
@unstable(feature = tls)
use wasi:io/error@0.2.3.{error as io-error};

@unstable(feature = tls)
resource client-handshake {
Expand All @@ -26,6 +28,6 @@ interface types {
subscribe: func() -> pollable;

@unstable(feature = tls)
get: func() -> option<result<result<tuple<client-connection, input-stream, output-stream>>>>;
get: func() -> option<result<result<tuple<client-connection, input-stream, output-stream>, io-error>>>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we be returning some type of error information for the first result here?

related to bytecodealliance/wasmtime#10429 (review)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This funky signature has been lifted from wasi-http:

https://github.com/WebAssembly/wasi-http/blob/main/wit/types.wit#L671-L686

    /// The outer `option` represents future readiness. Users can wait on this
    /// `option` to become `some` using the `subscribe` method.
    ///
    /// The outer `result` is used to retrieve the response or error at most
    /// once. It will be success on the first call in which the outer option
    /// is `some`, and error on subsequent calls.
    ///
    /// The inner `result` represents that either the incoming HTTP Response
    /// status and headers have received successfully, or that an error
    /// occurred. 
  • The outer result is there to signal that the inner result has already been consumed by a prior call.
  • The inner result is the actual result type of the future.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it thanks!

}
}