StableBuffer<X> is adapted directly from https://github.com/dfinity/motoko-base/blob/master/src/Buffer.mo,
ripping all functions and instance variables out of the Buffer class in order to make a stable, persistent
buffer.
Generic, mutable sequences that grow to accommodate arbitrary numbers of elements.
StableBuffer<X> provides extensible, mutable sequences of elements of type X.
that can be efficiently produced and consumed with imperative code.
A buffer object can be extended by a single element or the contents of another buffer object.
When required, the current state of a buffer object can be converted to a fixed-size array of its elements.
Buffers complement Motoko's non-extensible array types
(arrays do not support efficient extension, because the size of an array is
determined at construction and cannot be changed).
Generic, extensible buffers
StableBuffer<X>
is adapted directly from https://github.com/dfinity/motoko-base/blob/master/src/Buffer.mo, ripping all functions and instance variables out of theBuffer
class in order to make a stable, persistent buffer.Generic, mutable sequences that grow to accommodate arbitrary numbers of elements.
StableBuffer<X>
provides extensible, mutable sequences of elements of typeX
. that can be efficiently produced and consumed with imperative code. A buffer object can be extended by a single element or the contents of another buffer object.When required, the current state of a buffer object can be converted to a fixed-size array of its elements.
Buffers complement Motoko's non-extensible array types (arrays do not support efficient extension, because the size of an array is determined at construction and cannot be changed).