io.range

Members

Enums

isSplitFunction
eponymoustemplate isSplitFunction(alias fn, T, Separator)

Checks if the given function can be used with Splitter.

Functions

byChunk
auto byChunk(Stream stream, size_t size)
auto byChunk(Stream stream, ubyte[] buffer)

Convenience function for creating a ByChunk range over a stream.

endsWithSeparator
size_t endsWithSeparator(const(T)[] region, Separator separator)
size_t endsWithSeparator(const(T)[] region, Separator sep)

Checks if the given region ends with the given separator.

splitter
auto splitter(Stream stream, Separator separator)

Convenience function for returning a stream splitter.

testSplitter
void testSplitter(T[][] regions, Separator separator)
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

byBlock
auto byBlock [@property getter]

Helper function for constructing a block range.

Structs

ByBlock
struct ByBlock(T, Stream)

Wraps a stream in a range interface such that blocks of a fixed size are read from the source. It is assumed that the stream is buffered so that performance is not adversely affected.

ByChunk
struct ByChunk(Stream)

Range that reads up to a fixed size chunk of data from a stream at a time.

Splitter
struct Splitter(T, Separator, Stream, alias splitFn = endsWithSeparator!(T, Separator))

Splits a stream using a separator. The separator can be a single element or a bidirectional range of elements.

Meta

Authors

Jason White

Description: This module provides range interfaces for streams. This is useful for using many of the range operations in std._range and std.algorithm.

There is an important distinction between streams and ranges to be made. Fundamentally, a stream is a unidirectional stream of bytes. That is, there is no going backwards and there is no saving the current position (as bidirectional and forward ranges can do). This provides a good mapping to input ranges and output ranges. As streams only operate on raw bytes, ranges provide an abstraction to operate on more complex data types.