Module iopipe.bufpipe

Core functionality for iopipe. Defines the base types for manipulating and processing data.


arrayCastPipe(c) Given a pipe chain whose window is a straight array, create a pipe chain that converts the array to another array type.
asElemRange(c) Convert an io pipe into a range of elements of the pipe. This effectively converts an iopipe range of T into a range of T. Note that auto-decoding does NOT happen still, so converting a string into an input range produces a range of char. The range is extended when no more data is in the window.
asInputRange(c) Convert an io pipe into a range, with each popFront releasing all the current data and extending a specified amount.
bufd(dev, args) Create a buffer to manage the data from the given source, and wrap into an iopipe.
byteSwapper(c) Swap the bytes of every element before handing to next processor. The littleEndian compile-time parameter indicates what endianness the data is in. If it matches the platform's endianness, then nothing is done (no byte swap occurs). Otherwise, a byte swap processor is returned wrapping the io pipe.
ensureElems(chain, elems) Extend a pipe until it has a minimum number of elements. If the minimum elements are already present, does nothing.
iosrc(c) Create an input source from a given Chain, and a given translation function/template.
outputPipe(c, dev) An output pipe writes all its data to a given sink stream. Any data in the output pipe's window has been written to the stream.
process(c) Process a given iopipe chain until it has reached EOF. This is accomplished by extending and releasing continuously until extend returns 0.
rbufd(dev) Create a ring buffer to manage the data from the given source, and wrap into an iopipe.
writeBuf(c, data, offset) 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.


SimplePipe An example processor. This demonstrates the required items for implementing an iopipe.