bufd

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

  1. auto bufd(Source dev, Args args)
    bufd
    (
    T = ubyte
    size_t optimalReadSize = 8 * 1024 / T.sizeof
    Source
    Args...
    )
    (
    Source dev
    ,
    Args args
    )
    if (
    hasMember!(Source, "read") &&
    is(typeof(dev.read(T[].init)) == size_t)
    )
  2. auto bufd(Args args)

Parameters

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 Source

The input stream to use. If not specified, then a NullDev source is assumed.

args Args

Arguments passed to the allocator (for allocators that need initialization)

Return Value

Type: auto

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.

Meta