Tls module

reader_of

procedureextensionexperimentalSource

The stream as an Io.Reader, for code written against readers (Io.read_all, the Http client). Reading it is read; closing it closes the whole stream, once. The reader points at the stream, so it is only valid until close.

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

read_everything :: (stream: *Tls_Stream) -> string {
    data, error := Io.read_all(reader_of(stream));
    return cast(string) data;
}

This one is only checked to compile, not run.

reader_of :: (stream: *Tls_Stream) -> Io.Reader

The stream as an Io.Reader, for code written against readers (Io.read_all, the Http client). Reading it is read; closing it closes the whole stream, once. The reader points at the stream, so it is only valid until close.

Parameters

stream: *Tls_Stream
the stream to read through.

Returns

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

read_everything :: (stream: *Tls_Stream) -> string {
    data, error := Io.read_all(reader_of(stream));
    return cast(string) data;
}

This one is only checked to compile, not run.

See also