Skip to content
Menu
Contents

WasiIo

5 types25 functions

The wasi:io streams, errors and pollables WASI 0.2 interfaces pass around, shared by WasiCli and the other wasip2 modules that read and write streams. Every handle here is owned by whoever received it and is dropped explicitly.

At a glance

  • @InputStream

    The input-stream resource of wasi:io/streams@0.2.3, as a handle.

  • @OutputStream

    The output-stream resource of wasi:io/streams@0.2.3, as a handle.

  • @Error

    The error resource of wasi:io/error@0.2.3, as a handle.

  • @Pollable

    The pollable resource of wasi:io/poll@0.2.3, as a handle.

  • StreamError

    The view of WIT's stream-error type, from wasi:io/streams@0.2.3.

  • writeAll

    Write all of bytes to out, in chunks blocking-write-and-flush accepts, and say whether it all went.

  • writeAllResult

    Write all of bytes to out, in chunks blocking-write-and-flush accepts.

  • dropInputStream

    Drops the input-stream handle, from wasi:io/streams@0.2.3.

  • dropOutputStream

    Drops the output-stream handle, from wasi:io/streams@0.2.3.

  • errorToDebugString

    WIT's error.to-debug-string method, from wasi:io/error@0.2.3, in Bert's view of its types.

  • dropError

    Drops the error handle, from wasi:io/error@0.2.3.

  • pollableReady

    WIT's pollable.ready method, from wasi:io/poll@0.2.3, in Bert's view of its types.

  • pollableBlock

    WIT's pollable.block method, from wasi:io/poll@0.2.3, in Bert's view of its types.

  • poll

    WIT's poll function, from wasi:io/poll@0.2.3, in Bert's view of its types.

  • dropPollable

    Drops the pollable handle, from wasi:io/poll@0.2.3.

  • inputStreamRead

    WIT's input-stream.read method, from wasi:io/streams@0.2.3, in Bert's view of its types.

  • inputStreamBlockingRead

    WIT's input-stream.blocking-read method, from wasi:io/streams@0.2.3, in Bert's view of its types.

  • inputStreamSkip

    WIT's input-stream.skip method, from wasi:io/streams@0.2.3, in Bert's view of its types.

  • inputStreamBlockingSkip

    WIT's input-stream.blocking-skip method, from wasi:io/streams@0.2.3, in Bert's view of its types.

  • inputStreamSubscribe

    WIT's input-stream.subscribe method, from wasi:io/streams@0.2.3, in Bert's view of its types.

  • outputStreamCheckWrite

    WIT's output-stream.check-write method, from wasi:io/streams@0.2.3, in Bert's view of its types.

  • outputStreamWrite

    WIT's output-stream.write method, from wasi:io/streams@0.2.3, in Bert's view of its types.

  • outputStreamBlockingWriteAndFlush

    At most 4096 bytes a call; more traps.

  • outputStreamFlush

    WIT's output-stream.flush method, from wasi:io/streams@0.2.3, in Bert's view of its types.

  • outputStreamBlockingFlush

    WIT's output-stream.blocking-flush method, from wasi:io/streams@0.2.3, in Bert's view of its types.

  • outputStreamSubscribe

    WIT's output-stream.subscribe method, from wasi:io/streams@0.2.3, in Bert's view of its types.

  • outputStreamWriteZeroes

    WIT's output-stream.write-zeroes method, from wasi:io/streams@0.2.3, in Bert's view of its types.

  • outputStreamBlockingWriteZeroesAndFlush

    WIT's output-stream.blocking-write-zeroes-and-flush method, from wasi:io/streams@0.2.3, in Bert's view of its types.

  • outputStreamSplice

    WIT's output-stream.splice method, from wasi:io/streams@0.2.3, in Bert's view of its types.

  • outputStreamBlockingSplice

    WIT's output-stream.blocking-splice method, from wasi:io/streams@0.2.3, in Bert's view of its types.

Types

@InputStream

type @InputStream

The input-stream resource of wasi:io/streams@0.2.3, as a handle. It comes only from the functions here that return one. Release it with dropInputStream.

@OutputStream

type @OutputStream

The output-stream resource of wasi:io/streams@0.2.3, as a handle. It comes only from the functions here that return one. Release it with dropOutputStream.

@Error

type @Error

The error resource of wasi:io/error@0.2.3, as a handle. It comes only from the functions here that return one. Release it with dropError.

@Pollable

type @Pollable

The pollable resource of wasi:io/poll@0.2.3, as a handle. It comes only from the functions here that return one. Release it with dropPollable.

StreamError

StreamError = [LastOperationFailed(@Error) | Closed]

The view of WIT's stream-error type, from wasi:io/streams@0.2.3.

Functions

writeAll

(@OutputStream, Bytes.@Bytes) -> Boolimpure

Write all of bytes to out, in chunks blocking-write-and-flush accepts, and say whether it all went. A stream that fails or closes drops the rest; its error is dropped too.

writeAllResult

(@OutputStream, Bytes.@Bytes) -> [Ok(Unit) | Err(StreamError)]impure

Write all of bytes to out, in chunks blocking-write-and-flush accepts. A stream that fails or closes drops the rest and answers the stream's error, whose @Error the caller then owns and drops.

dropInputStream

(@InputStream) -> Unitimpure

Drops the input-stream handle, from wasi:io/streams@0.2.3. Nothing else releases it, and the handle is not used after.

dropOutputStream

(@OutputStream) -> Unitimpure

Drops the output-stream handle, from wasi:io/streams@0.2.3. Nothing else releases it, and the handle is not used after.

errorToDebugString

(@Error) -> Stringimpure

WIT's error.to-debug-string method, from wasi:io/error@0.2.3, in Bert's view of its types.

dropError

(@Error) -> Unitimpure

Drops the error handle, from wasi:io/error@0.2.3. Nothing else releases it, and the handle is not used after.

pollableReady

(@Pollable) -> Boolimpure

WIT's pollable.ready method, from wasi:io/poll@0.2.3, in Bert's view of its types.

pollableBlock

(@Pollable) -> Unitimpure

WIT's pollable.block method, from wasi:io/poll@0.2.3, in Bert's view of its types.

poll

(List(@Pollable)) -> List(Int)impure

WIT's poll function, from wasi:io/poll@0.2.3, in Bert's view of its types.

dropPollable

(@Pollable) -> Unitimpure

Drops the pollable handle, from wasi:io/poll@0.2.3. Nothing else releases it, and the handle is not used after.

inputStreamRead

(@InputStream, Int) -> [Ok(Bytes.@Bytes) | Err(StreamError)]impure

WIT's input-stream.read method, from wasi:io/streams@0.2.3, in Bert's view of its types.

inputStreamBlockingRead

(@InputStream, Int) -> [Ok(Bytes.@Bytes) | Err(StreamError)]impure

WIT's input-stream.blocking-read method, from wasi:io/streams@0.2.3, in Bert's view of its types.

inputStreamSkip

(@InputStream, Int) -> [Ok(Int) | Err(StreamError)]impure

WIT's input-stream.skip method, from wasi:io/streams@0.2.3, in Bert's view of its types.

inputStreamBlockingSkip

(@InputStream, Int) -> [Ok(Int) | Err(StreamError)]impure

WIT's input-stream.blocking-skip method, from wasi:io/streams@0.2.3, in Bert's view of its types.

inputStreamSubscribe

WIT's input-stream.subscribe method, from wasi:io/streams@0.2.3, in Bert's view of its types.

outputStreamCheckWrite

(@OutputStream) -> [Ok(Int) | Err(StreamError)]impure

WIT's output-stream.check-write method, from wasi:io/streams@0.2.3, in Bert's view of its types.

outputStreamWrite

(@OutputStream, Bytes.@Bytes) -> [Ok(Unit) | Err(StreamError)]impure

WIT's output-stream.write method, from wasi:io/streams@0.2.3, in Bert's view of its types.

outputStreamBlockingWriteAndFlush

(@OutputStream, Bytes.@Bytes) -> [Ok(Unit) | Err(StreamError)]impure

At most 4096 bytes a call; more traps.

outputStreamFlush

(@OutputStream) -> [Ok(Unit) | Err(StreamError)]impure

WIT's output-stream.flush method, from wasi:io/streams@0.2.3, in Bert's view of its types.

outputStreamBlockingFlush

(@OutputStream) -> [Ok(Unit) | Err(StreamError)]impure

WIT's output-stream.blocking-flush method, from wasi:io/streams@0.2.3, in Bert's view of its types.

outputStreamSubscribe

WIT's output-stream.subscribe method, from wasi:io/streams@0.2.3, in Bert's view of its types.

outputStreamWriteZeroes

(@OutputStream, Int) -> [Ok(Unit) | Err(StreamError)]impure

WIT's output-stream.write-zeroes method, from wasi:io/streams@0.2.3, in Bert's view of its types.

outputStreamBlockingWriteZeroesAndFlush

(@OutputStream, Int) -> [Ok(Unit) | Err(StreamError)]impure

WIT's output-stream.blocking-write-zeroes-and-flush method, from wasi:io/streams@0.2.3, in Bert's view of its types.

outputStreamSplice

(@OutputStream, @InputStream, Int) -> [Ok(Int) | Err(StreamError)]impure

WIT's output-stream.splice method, from wasi:io/streams@0.2.3, in Bert's view of its types.

outputStreamBlockingSplice

(@OutputStream, @InputStream, Int) -> [Ok(Int) | Err(StreamError)]impure

WIT's output-stream.blocking-splice method, from wasi:io/streams@0.2.3, in Bert's view of its types.