@@ -491,13 +491,16 @@ to the output-stream defined in the <code>wasi-io</code> interface.</p>
491491<p >
492492#### <a name =" incoming_value " >` resource incoming-value ` </a >
493493<p >A incoming-value is a wrapper around a value. It provides a way to read the value
494- from the input-stream defined in the <code >wasi-io</code > interface.</p >
494+ from the < a href = " #input_stream " >< code > input-stream</ code ></ a > defined in the <code >wasi-io</code > interface.</p >
495495<p >The incoming-value provides two ways to consume the value:</p >
496496<ol >
497497<li ><code >incoming-value-consume-sync</code > consumes the value synchronously and returns the
498- value as a list of bytes .</li >
498+ value as a < code > list& lt ; u8 & gt ; </ code > .</li >
499499<li ><code >incoming-value-consume-async</code > consumes the value asynchronously and returns the
500- value as an input-stream.</li >
500+ value as an <a href =" #input_stream " ><code >input-stream</code ></a >.
501+ In addition, it provides a <code >incoming-value-size</code > function to get the size of the value.
502+ This is useful when the value is large and the caller wants to allocate a buffer of
503+ the right size to consume the value.</li >
501504</ol >
502505<h4 ><a name =" incoming_value_async_body " ><code >type incoming-value-async-body</code ></a ></h4 >
503506<p ><a href =" #input_stream " ><a href =" #input_stream " ><code >input-stream</code ></a ></a ></p >
@@ -508,6 +511,8 @@ value as an input-stream.</li>
508511----
509512<h3 >Functions</h3 >
510513<h4 ><a name =" static_bucket.open_bucket " ><code >[static]bucket.open-bucket: func</code ></a ></h4 >
514+ <p >Opens a bucket with the given name.</p >
515+ <p >If any error occurs, including if the bucket does not exist, it returns an <code >Err(error)</code >.</p >
511516<h5 >Params</h5 >
512517<ul >
513518<li ><a name =" static_bucket.open_bucket.name " ><code >name</code ></a >: <code >string</code ></li >
@@ -522,6 +527,8 @@ value as an input-stream.</li>
522527<li ><a name =" static_outgoing_value.new_outgoing_value.0 " ></a > own< ; <a href =" #outgoing_value " ><a href =" #outgoing_value " ><code >outgoing-value</code ></a ></a >> ; </li >
523528</ul >
524529<h4 ><a name =" method_outgoing_value.outgoing_value_write_body_async " ><code >[method]outgoing-value.outgoing-value-write-body-async: func</code ></a ></h4 >
530+ <p >Writes the value to the output-stream asynchronously.
531+ If any other error occurs, it returns an <code >Err(error)</code >.</p >
525532<h5 >Params</h5 >
526533<ul >
527534<li ><a name =" method_outgoing_value.outgoing_value_write_body_async.self " ><code >self</code ></a >: borrow< ; <a href =" #outgoing_value " ><a href =" #outgoing_value " ><code >outgoing-value</code ></a ></a >> ; </li >
@@ -531,6 +538,8 @@ value as an input-stream.</li>
531538<li ><a name =" method_outgoing_value.outgoing_value_write_body_async.0 " ></a > result< ; own< ; <a href =" #outgoing_value_body_async " ><a href =" #outgoing_value_body_async " ><code >outgoing-value-body-async</code ></a ></a >> ; , own< ; <a href =" #error " ><a href =" #error " ><code >error</code ></a ></a >> ;> ; </li >
532539</ul >
533540<h4 ><a name =" method_outgoing_value.outgoing_value_write_body_sync " ><code >[method]outgoing-value.outgoing-value-write-body-sync: func</code ></a ></h4 >
541+ <p >Writes the value to the output-stream synchronously.
542+ If any other error occurs, it returns an <code >Err(error)</code >.</p >
534543<h5 >Params</h5 >
535544<ul >
536545<li ><a name =" method_outgoing_value.outgoing_value_write_body_sync.self " ><code >self</code ></a >: borrow< ; <a href =" #outgoing_value " ><a href =" #outgoing_value " ><code >outgoing-value</code ></a ></a >> ; </li >
@@ -541,6 +550,8 @@ value as an input-stream.</li>
541550<li ><a name =" method_outgoing_value.outgoing_value_write_body_sync.0 " ></a > result< ; _, own< ; <a href =" #error " ><a href =" #error " ><code >error</code ></a ></a >> ;> ; </li >
542551</ul >
543552<h4 ><a name =" method_incoming_value.incoming_value_consume_sync " ><code >[method]incoming-value.incoming-value-consume-sync: func</code ></a ></h4 >
553+ <p >Consumes the value synchronously and returns the value as a list of bytes.
554+ If any other error occurs, it returns an <code >Err(error)</code >.</p >
544555<h5 >Params</h5 >
545556<ul >
546557<li ><a name =" method_incoming_value.incoming_value_consume_sync.self " ><code >self</code ></a >: borrow< ; <a href =" #incoming_value " ><a href =" #incoming_value " ><code >incoming-value</code ></a ></a >> ; </li >
@@ -550,6 +561,8 @@ value as an input-stream.</li>
550561<li ><a name =" method_incoming_value.incoming_value_consume_sync.0 " ></a > result< ; <a href =" #incoming_value_sync_body " ><a href =" #incoming_value_sync_body " ><code >incoming-value-sync-body</code ></a ></a >, own< ; <a href =" #error " ><a href =" #error " ><code >error</code ></a ></a >> ;> ; </li >
551562</ul >
552563<h4 ><a name =" method_incoming_value.incoming_value_consume_async " ><code >[method]incoming-value.incoming-value-consume-async: func</code ></a ></h4 >
564+ <p >Consumes the value asynchronously and returns the value as an <a href =" #input_stream " ><code >input-stream</code ></a >.
565+ If any other error occurs, it returns an <code >Err(error)</code >.</p >
553566<h5 >Params</h5 >
554567<ul >
555568<li ><a name =" method_incoming_value.incoming_value_consume_async.self " ><code >self</code ></a >: borrow< ; <a href =" #incoming_value " ><a href =" #incoming_value " ><code >incoming-value</code ></a ></a >> ; </li >
@@ -558,14 +571,16 @@ value as an input-stream.</li>
558571<ul >
559572<li ><a name =" method_incoming_value.incoming_value_consume_async.0 " ></a > result< ; own< ; <a href =" #incoming_value_async_body " ><a href =" #incoming_value_async_body " ><code >incoming-value-async-body</code ></a ></a >> ; , own< ; <a href =" #error " ><a href =" #error " ><code >error</code ></a ></a >> ;> ; </li >
560573</ul >
561- <h4 ><a name =" method_incoming_value.size " ><code >[method]incoming-value.size: func</code ></a ></h4 >
574+ <h4 ><a name =" method_incoming_value.incoming_value_size " ><code >[method]incoming-value.incoming-value-size: func</code ></a ></h4 >
575+ <p >The size of the value in bytes.
576+ If the size is unknown or unavailable, this function returns an <code >Err(error)</code >.</p >
562577<h5 >Params</h5 >
563578<ul >
564- <li ><a name =" method_incoming_value.size .self " ><code >self</code ></a >: borrow< ; <a href =" #incoming_value " ><a href =" #incoming_value " ><code >incoming-value</code ></a ></a >> ; </li >
579+ <li ><a name =" method_incoming_value.incoming_value_size .self " ><code >self</code ></a >: borrow< ; <a href =" #incoming_value " ><a href =" #incoming_value " ><code >incoming-value</code ></a ></a >> ; </li >
565580</ul >
566581<h5 >Return values</h5 >
567582<ul >
568- <li ><a name =" method_incoming_value.size .0 " ></a > <code >u64</code ></li >
583+ <li ><a name =" method_incoming_value.incoming_value_size .0 " ></a > result & lt ; <code >u64</code >, own & lt ; < a href = " #error " >< a href = " #error " >< code >error</ code ></ a ></ a > & gt ;& gt ; </li >
569584</ul >
570585<h2 ><a name =" wasi:keyvalue_readwrite " >Import interface wasi:keyvalue/readwrite</a ></h2 >
571586<p >A keyvalue interface that provides simple read and write operations.</p >
0 commit comments