Struct ReadBuffer

Self-expanding buffer, that can be used with functions returning the number of the read bytes.

struct ReadBuffer(T)
  
if (isScalarType!T);

This buffer supports asynchronous reading. It means you can pass a new chunk to an asynchronous read function during you are working with already available data. But only one asynchronous call at a time is supported. Be sure to call ReadBuffer.clear() before you append the result of the pended asynchronous call.

Constructors

NameDescription
this (size, minAvailable, allocator) Creates a new read buffer.

Fields

NameTypeDescription
blockSize size_tSize by which the buffer will grow.
buffer_ T[]Internal buffer.
length_ size_tFilled buffer length.
minAvailable size_tAvailable space.
ring size_tLast position returned with [].
start size_tStart of available data.

Properties

NameTypeDescription
capacity[get] size_t
free[get] size_t
length[get] size_t

Methods

NameDescription
clear () Clears the buffer.
opIndex () Returns a free chunk of the buffer.
opOpAssign (length) Appends some data to the buffer.
opSlice (start, end)

Aliases

NameDescription
opDollar

Parameters

NameDescription
T Buffer type.