Skip to content

Stream[R, I, O]

A Strand with channel-backed input and output, created by stream.

Its iterator re-raises a strand error after draining output; its sink reports ordinary shutdown after input closes.

Inherits from: Iterable[I], Sinkable[O]

Fields

done @ Bool

Whether the strand has completed execution.

Methods

cancel()

Requests cancellation of the strand, causing a Canceled error to be raised at the strand's next suspension point.

join() -> R

Closes both channels, then waits for the strand to complete. If the strand exited normally, returns its result. If the strand exited with an error, re-raises it.

Closing the channels before waiting prevents deadlock when the strand is blocked waiting for input or waiting for a consumer to read its output.

wait()

Waits for the strand to complete. Unlike join(), this method does not close the channels, does not return the strand's result, and does not re-raise any error.