Function WriteBuffer.length

Note that length doesn't return the real length of the data, but only the array length that will be returned with opIndex next time. Be sure to call opIndex and set += until length returns 0.

size_t length() const @property;

Returns

Data size.

Example

auto b = WriteBuffer!ubyte(4);
ubyte[3] buf = [48, 23, 255];

b ~= buf;
assert(b.length == 3);
b += 2;
assert(b.length == 1);

b ~= buf;
assert(b.length == 2);
b += 2;
assert(b.length == 2);

b ~= buf;
assert(b.length == 5);
b += b.length;
assert(b.length == 0);