diff --git a/wit-0.3.0-draft/types.wit b/wit-0.3.0-draft/types.wit index d720fbe..2e785a8 100644 --- a/wit-0.3.0-draft/types.wit +++ b/wit-0.3.0-draft/types.wit @@ -240,14 +240,27 @@ interface types { /// trailers at any given time. resource body { + /// Construct a new `body` with the specified stream. + /// + /// This function returns a future, which will resolve + /// to an error code if transmitting stream data fails. + /// + /// The returned future resolves to success once body stream + /// is fully transmitted. + new: static func( + %stream: stream, + ) -> tuple>>; + /// Construct a new `body` with the specified stream and trailers. + /// /// This function returns a future, which will resolve /// to an error code if transmitting stream data or trailers fails. + /// /// The returned future resolves to success once body stream and trailers /// are fully transmitted. - new: static func( + new-with-trailers: static func( %stream: stream, - trailers: option> + trailers: future ) -> tuple>>; /// Returns the contents of the body, as a stream of bytes. @@ -260,9 +273,10 @@ interface types { /// The returned future resolves to success if body is closed. %stream: func() -> result>, future>>; - /// Takes ownership of `body`, and returns a `trailers`. This function will - /// trap if a `stream` child is still alive. - finish: static func(this: body) -> result, error-code>; + /// Takes ownership of `body`, and returns an unresolved optional `trailers`. + /// + /// This function will trap if a `stream` child is still alive. + finish: static func(this: body) -> future>; } /// Represents an HTTP Request.