Function writeBuf

Write data from a random access range or character array into the given iopipe. If relOnWrite is set to true (ReleaseOnWrite.yes), then all data before the provided offset, and any new data written to the pipe is always released. This is mainly useful for output buffers where you do not wish to allocate extra space in the buffer, and wish to flush the buffer when it's full.

size_t writeBuf(std.typecons.Flag!("releaseOnWrite") relOnWrite = ReleaseOnWrite.yes, Chain, Range) (
  ref Chain c,
  Range data,
  size_t offset = 0
)
if (isIopipe!Chain && __traits(compiles, c.window[0..0] = data[0..0]));

If relOnWrite is false, then the pipe data is not released, and you should consider the "written" part to be the offset + the return value.

Parameters

NameDescription
c The iopipe chain to write to.
data The range to write to the chain.
offset The starting point to write the data.
relOnWrite If true, data is released as it is written, otherwise, it's not released.

Returns

The number of elements written. This should match the elements of the range, but could potentially be less if there wasn't a way to extend more space and more space was needed.