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.
- stream: the stream to read through.
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
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.