Buffer.this

Creates a buffer from an array of data. The chunk size is set to the size of array.

  1. this(size_t chunk)
  2. this(T[] data)
    class Buffer
    pure nothrow @trusted @nogc
    this
    (
    T
    )
    (
    in T[] data...
    )

Examples

t {
		
		Buffer buffer = new Buffer(cast(ubyte[])[1, 2, 3, 4]);
		assert(buffer.index == 0);
		assert(buffer.length == 4);
		
		buffer = new Buffer([1, 2]);
		assert(buffer.index == 0);
		assert(buffer.length == 8);
	

Meta