Function WriteBuffer.opDollar

ulong opDollar() pure nothrow @property @nogc @safe const;

Returns

Length of available data.

Example

auto b = defaultAllocator.make!WriteBuffer(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);

defaultAllocator.dispose(b);