Function bufd

Create a buffer to manage the data from the given source, and wrap into an iopipe.

auto auto bufd(T, Allocator, ulong optimalReadSize = 8 * 1024 / T.sizeof, Source) (
  Source dev
)
if (hasMember!(Source, "read") && is(typeof(dev.read(T[].init)) == size_t));

auto auto bufd(T, Allocator, ulong optimalReadSize = 8 * 1024 / T.sizeof) ();

Parameters

NameDescription
T The type of element to allocate with the allocator
Allocator The allocator to use for managing the buffer
Source The type of the input stream. This must have a function read that can read into the buffer's window.
dev The input stream to use. If not specified, then a NullDev source is assumed.

Returns

An iopipe that uses the given buffer to read data from the given device source.