Clone
Returns an independent copy of the string.
Module: Text
Signature
rux
func Clone(self) -> String;Returns
A String holding the same bytes in a block of its own. Cloning the empty string allocates nothing.
Assignment copies the struct, not the block, so two String values can name the same allocation — freeing both is a double free. Clone is what to reach for when both of them have to be freed, and each copy is then released with its own Free.
Example
rux
import Text::String;
var original = String::From("Rux");
var shared = original; // same block; free one of them, not both
var copy = original.Clone(); // its own block
copy == original; // true -- Equals compares bytes, not addresses
copy.Free();
original.Free();