Function bufd
Create a buffer to manage the data from the given source, and wrap into an iopipe.
auto bufd(T, Allocator, ulong optimalReadSize = 8 * 1024 / T .sizeof, Source, Args...)
(
Source dev,
Args args
)
if (hasMember!(Source, "read") && is(typeof(dev .read(T[] .init)) == size_t));
auto bufd(T, Allocator, ulong optimalReadSize = T .sizeof > 4 ? 8 : 32 / T .sizeof, Args...)
(
Args args
);
Parameters
Name | Description |
---|---|
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. |
args | Arguments passed to the allocator (for allocators that need initialization) |
Returns
An iopipe that uses the given buffer to read data from the given device source. The version which takes no parameter uses a NullDev as a source.