vibe.d beta banner
get vibe.d
0.10.1

Asynchronous I/O that doesn’t get in your way, written in D

Struct StreamInputRange

Implements an input range interface on top of an InputStream using an internal buffer.

struct StreamInputRange(InputStream, ulong buffer_size = 256)
  
if (isInputStream!InputStream);

The buffer is GC allocated and is filled chunk wise. Thus an InputStream that has been wrapped in a StreamInputRange cannot be used reliably on its own anymore.

Reading occurs in a fully lazy fashion. The first call to either front, popFront or empty will potentially trigger waiting for the next chunk of data to arrive - but especially popFront will not wait if it was called after a call to front. This property allows the range to be used in request-response scenarios.

Constructors

NameDescription
this (stream)

Fields

NameTypeDescription
m_buffer StreamInputRange.Buffer*
m_stream InputStream

Properties

NameTypeDescription
empty[get] bool

Methods

NameDescription
front ()
popFront ()
readChunk ()

Inner structs

NameDescription
Buffer
Authors

Sönke Ludwig

Copyright

© 2013-2016 Sönke Ludwig

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.