readAll

Reads all available elements from an input stream, and collects them in an allocated buffer. If calling hasData() on the return value of this function returns true, you need to free that data yourself, as it has been allocated via malloc.

Either!(E[], "data", StreamError, "error")
readAll
(
S
E = StreamType!S
uint BufferSize = 4096
)
(
ref S stream
)

Parameters

stream S

The stream to read from.

Return Value

Type: Either!(E[], "data", StreamError, "error")

Either the data that was read, as a malloc'd buffer that should be freed with free(result.data.ptr), or a StreamError if something went wrong.

Meta