diff --git a/imports.md b/imports.md
index 6e50d1a..03f0a7b 100644
--- a/imports.md
+++ b/imports.md
@@ -521,6 +521,13 @@ Soon: switch to resource incoming-value { ... }
own<outgoing-value
>
[method]outgoing-value.outgoing-value-write-body: func
+Returns a stream for writing the value contents.
+The returned output-stream
is a child resource: it must be dropped
+before the parent outgoing-value
resource is dropped (or finished),
+otherwise the outgoing-value
drop or finish
will trap.
+Returns success on the first call: the output-stream
resource for
+this outgoing-value
may be retrieved at most once. Subsequent calls
+will return error.
Params
self
: borrow<outgoing-value
>
@@ -529,6 +536,19 @@ Soon: switch to resource incoming-value { ... }
+[static]outgoing-value.finish: func
+Finalize an outgoing value. This must be
+called to signal that the outgoing value is complete. If the outgoing-value
+is dropped without calling outgoing-value.finalize
, the implementation
+should treat the value as corrupted.
+Params
+
+Return values
+
[static]incoming-value.incoming-value-consume-sync: func
Params
diff --git a/wit/types.wit b/wit/types.wit
index 979b054..ca59724 100644
--- a/wit/types.wit
+++ b/wit/types.wit
@@ -52,7 +52,23 @@ interface types {
// Soon: switch to `resource value { ... }`
resource outgoing-value {
new-outgoing-value: static func() -> outgoing-value;
+
+ /// Returns a stream for writing the value contents.
+ ///
+ /// The returned `output-stream` is a child resource: it must be dropped
+ /// before the parent `outgoing-value` resource is dropped (or finished),
+ /// otherwise the `outgoing-value` drop or `finish` will trap.
+ ///
+ /// Returns success on the first call: the `output-stream` resource for
+ /// this `outgoing-value` may be retrieved at most once. Subsequent calls
+ /// will return error.
outgoing-value-write-body: func() -> result;
+
+ /// Finalize an outgoing value. This must be
+ /// called to signal that the outgoing value is complete. If the `outgoing-value`
+ /// is dropped without calling `outgoing-value.finalize`, the implementation
+ /// should treat the value as corrupted.
+ finish: static func(this: outgoing-value) -> result<_, error>;
}
/// A incoming-value is a wrapper around a value. It provides a way to read the value