@@ -265,29 +265,28 @@ interface types {
265265
266266 /// Returns the contents of the body, as a stream of bytes.
267267 ///
268- /// This function returns a stream and a future, which will resolve
268+ /// This method returns a stream and a future, which will resolve
269269 /// to an error code if receiving data from stream fails.
270270 /// The returned future resolves to success if data section of the
271271 /// body is fully consumed.
272272 ///
273- /// The handles returned by this function are considered to be child
274- /// handles. Dropping the resource on which this function is called
273+ /// The handles returned by this method are considered to be child
274+ /// handles. Dropping the resource on which this method is called
275275 /// will close the handles with an error context, if they are still open.
276276 ///
277- /// This function may be called multiple times.
278- /// If it is called while either a stream or future returned by a previous
279- /// call to this function is still open, those handles will be closed
280- /// with an error context. Thus there will always be at most one readable stream
281- /// open for a given body. Each subsequent stream picks up where the last
282- /// stream left off, up until `finish` is called.
283- %stream : func () -> tuple <stream <u8 >, future <result <_ , error-code >>>;
277+ /// This method may be called multiple times.
278+ /// If it is called while either a stream or future returned by a previous
279+ /// call to this method is still open, this method will return an error.
280+ /// Thus there will always be at most one readable stream open for a given body.
281+ /// Each subsequent stream picks up where the last stream left off,
282+ /// up until `finish` is called.
283+ %stream : func () -> result < tuple <stream <u8 >, future <result <_ , error-code > >>>;
284284
285285 /// Takes ownership of `body` , and returns an unresolved optional `trailers` result.
286286 ///
287- /// Developers are encouraged to close any open handles returned by previous
288- /// calls to `stream` , if any, before calling this function,
289- /// but calling `finish` will close them with an error context.
290- finish : static func (this : body ) -> future <result <option <trailers >, error-code >>;
287+ /// If this function is called while either a stream or future returned by a previous
288+ /// call to `body.stream` is still open, this function will return an error.
289+ finish : static func (this : body ) -> result <future <result <option <trailers >, error-code >>>;
291290 }
292291
293292 /// Represents an HTTP Request.
@@ -368,14 +367,12 @@ interface types {
368367 /// to another component by e.g. `handler.handle` .
369368 ///
370369 /// Only a single body resource can be active at a time.
371- /// If this function is called before the body resource returned by
372- /// a previous call to this function is dropped, the previously-returned
373- /// body will be transitioned into an "error state" and all operations
374- /// on it will fail.
370+ /// If this method is called before the body resource returned by
371+ /// a previous call to this method is dropped, error will be returned.
375372 ///
376373 /// Once `body.finish` is called on a body returned by this method,
377- /// all subsequent calls to this method will return `none` .
378- body : func () -> option <body >;
374+ /// all subsequent calls to this method will return `ok( none) ` .
375+ body : func () -> result < option <body > >;
379376
380377 /// Takes ownership of the `request` and returns the `headers` , `body`
381378 /// and `request-options` , if any.
@@ -385,6 +382,8 @@ interface types {
385382 /// in the immutable `headers` resources, that could have been acquired by calls to `headers`
386383 /// prior to this method being called.
387384 ///
385+ /// If a body child exists when this function is called, an error will be returned.
386+ ///
388387 /// Once `body.finish` is called on a body returned by a previous
389388 /// call to `body` method, this method returns body as `none` .
390389 into-parts : static func (this : request ) -> tuple <headers , option <body >, option <request-options >>;
@@ -464,14 +463,12 @@ interface types {
464463 /// to another component by e.g. `handler.handle` .
465464 ///
466465 /// Only a single body resource can be active at a time.
467- /// If this function is called before the body resource returned by
468- /// a previous call to this function is dropped, the previously-returned
469- /// body will be transitioned into an "error state" and all operations
470- /// on it will fail.
466+ /// If this method is called before the body resource returned by
467+ /// a previous call to this method is dropped, error will be returned.
471468 ///
472469 /// Once `body.finish` is called on a body returned by this method,
473- /// all subsequent calls to this method will return `none` .
474- body : func () -> option <body >;
470+ /// all subsequent calls to this method will return `ok( none) ` .
471+ body : func () -> result < option <body > >;
475472
476473 /// Takes ownership of the `response` and returns the `headers` and `body` ,
477474 /// if any.
@@ -481,8 +478,10 @@ interface types {
481478 /// in the immutable `headers` resources, that could have been acquired by calls to `headers`
482479 /// prior to this method being called.
483480 ///
481+ /// If a body child exists when this function is called, an error will be returned.
482+ ///
484483 /// Once `body.finish` is called on a body returned by a previous
485484 /// call to `body` method, this method returns body as `none` .
486- into-parts : static func (this : response ) -> tuple <headers , option <body >>;
485+ into-parts : static func (this : response ) -> result < tuple <headers , option <body > >>;
487486 }
488487}
0 commit comments