FastAppender

Optimized appender. Not copyable.

Constructors

this
this(size_t capacity)

Preallocate

this
this(I[] arr)

Start with a given buffer

Destructor

~this
~this()
Undocumented in source.

Postblit

this(this)
this(this)
Undocumented in source.

Members

Aliases

allocator
alias allocator = Allocator.instance
Undocumented in source.
put
alias put = putEx
Undocumented in source.

Functions

allocate
T[] allocate(size_t len)

Allocate a number of bytes, without initializing them, and return the slice to be filled in. The slice reference is temporary, and valid until the next allocation.

clear
void clear()

Effectively empties the data, but preserves the storage for reuse. Same as setting length to 0.

get
I[] get()

Get a reference to the buffer. Ownership of the buffer is passed to the caller (Appender will not deallocate it after this call).

opOpAssign
void opOpAssign(U item)

~= support.

peek
I[] peek()

As with get, but ownership is preserved. The return value is valid until the next allocation, or until Appender is destroyed.

preallocate
void preallocate(size_t len)

Ensure we can append at least len more bytes before allocating.

putEx
void putEx(U items)

Put elements. Accepts any number of items (and will allocate at most once per call). Items can be of the element type (I), or arrays.

uncheckedPut
void uncheckedPut(U items)

Unsafe. Use together with preallocate().

Properties

capacity
size_t capacity [@property getter]

How many items can be appended without a reallocation.

capacity
size_t capacity [@property setter]

Resize backing buffer to the given capacity.

length
size_t length [@property getter]

How many items have been written so far.

length
size_t length [@property setter]

Set the length (up to the current capacity).

Variables

allocator
Allocator allocator;

The allocator.

Meta