Capacity
Returns how many bytes fit before the block has to grow.
Module: Text
Signature
rux
func Capacity(self) -> uint;Returns
The size of the block in bytes, and 0 for a builder that has not taken one yet. Everything up to this can be written without reallocating; the first byte past it doubles the block.
Capacity only ever grows on its own — Clear keeps it, and Shrink is what hands it back.
Example
rux
import Text::StringBuilder;
var builder = StringBuilder::New();
builder.Capacity(); // 0
builder.Append("Rux");
builder.Capacity(); // 16 -- the floor the first append takes
builder.Clear();
builder.Capacity(); // 16 still -- Clear keeps the block
builder.Free();See also
StringBuilder— the builder typeLength— how much of the capacity is usedReserve— ask for more room up frontShrink— hand back what is unused