Io module

make_pipe

procedureextensionexperimentalSource

Two connected ends. What one writes the other reads. close both when done (they free themselves once both are closed).

Example↗
Io :: #import "Extensions/Io";

Io.io_run(() {
    client, server := Io.make_pipe();
    defer Io.close(client);
    defer Io.close(server);

    Io.write(client, "ping");

    buffer: [8] u8;
    count, error := Io.read(server, buffer);
    assert(error == .NONE && string.{ count, buffer.data } == "ping");
});
make_pipe :: () -> (*Pipe_Stream, *Pipe_Stream)

Returns