Free
Releases the block the builder owns.
Module: Text
Signature
rux
func Free(self);Remarks
There are no destructors, so ownership is released by hand, as it is for String::Free. It leaves an empty builder behind — Length and Capacity back to 0 — so a second call is a no-op, and the builder stays usable and will take a fresh block on the next append.
It is safe on a builder that owns nothing, which is what a builder is after IntoString has given its block away. Calling it there releases nothing and is not a double free.
To keep the block and only forget the contents, use Clear.
Example
rux
import Text::StringBuilder;
var builder = StringBuilder::New();
builder.Append("Rux");
builder.Free();
builder.IsEmpty(); // true
builder.Append("again"); // fine -- the builder takes a new block
builder.Free();See also
StringBuilder— the builder typeClear— forget the contents but keep the blockIntoString— give the block away instead of releasing itString::Free— the same by-hand release for a string