Standard Library
class IOStream<T>
A stream that can be both read and written, with both ends over one queue.
since 0.1.0-alpha.1linuxwindows
- bases
InStream<T>,OutStream<T>
Overview
An IOStream has everything an InStream and an OutStream have: write with <<, read with
pull, pullOrNone, subscribe, for or asSeq, and close with close. Values written to
it come back out of it in order.
Examples
StreamBuffer<string> buf = StreamBuffer();
IOStream<string> pipe = IOStream(buf);
pipe << "ping" << "pong";
console.writeln(pipe.pull());
console.writeln(pipe.pull());
console.writeln(pipe.hasData());
pipe.close();
pipe << "late";
console.writeln(pipe.hasData());
ping
pong
false
false
Constructors
new
new(StreamBuffer<T> b)Create a read and write stream over the buffer b.
Parameters
- b
- The buffer shared by both ends.
Examples
IOStream<int> pipe = IOStream(StreamBuffer());
pipe << 5;
console.writeln(pipe.pull());
5