Types
use enum error-code
from wasi:cli/types@0.3.0
ioInput/output error
illegal-byte-sequenceInvalid or incomplete multibyte or wide character
pipeBroken pipe
Functions
read-via-stream: func() -> tuple<stream<u8>, future<result<_, error-code>>>since 0.3.0
Return a stream for reading from stdin.
This function returns a stream which provides data read from stdin, and a future to signal read results.
If the stream's readable end is dropped the future will resolve to success.
If the stream's writable end is dropped the future will either resolve to success if stdin was closed by the writer or to an error-code if reading failed for some other reason.
Multiple streams may be active at the same time. The behavior of concurrent reads is implementation-specific.
WIT
@since(version = 0.3.0)
interface stdin {
use types.{error-code};
/// Return a stream for reading from stdin.
///
/// This function returns a stream which provides data read from stdin,
/// and a future to signal read results.
///
/// If the stream's readable end is dropped the future will resolve to success.
///
/// If the stream's writable end is dropped the future will either resolve to
/// success if stdin was closed by the writer or to an error-code if reading
/// failed for some other reason.
///
/// Multiple streams may be active at the same time. The behavior of concurrent
/// reads is implementation-specific.
@since(version = 0.3.0)
read-via-stream: func() -> tuple<stream<u8>, future<result<_, error-code>>>;
}