WebAssembly / wasi-io

I/O Types proposal for WASI
Other
143 stars 19 forks source link

input-stream uses result type like output-stream; single stream-error definition has error resource #52

Closed pchickey closed 1 year ago

pchickey commented 1 year ago

Replaces #50

This PR includes two changes which were first made over in Wasmtime:

The input-stream methods now return the same stream-error, fka write-error, as the output-stream methods. This change does eliminate the expression of input-stream.read to indicate both a successful read has completed, and the end of stream being reached. While that corner case will now take one additional call to read, the ergonomics are better and reflect what many client apis expect in e.g. libc. It also allows us to unify on one single stream-error type being returned across all input-stream and output-stream methods. We found that the implementation and tests changes for this interface change made both seem nicer, subjectively.

stream-error's last-operation-failed variant now contains a payload resource error. This implements the change described in https://github.com/WebAssembly/wasi-io/issues/47.