1234567module juptune.core.ds.string;
String fromDestroyingArray(
ArrayT
)(
ArrayT arr
);
A named constructor for Stringthat will convert the given char-based Arrayinto a string, and then destroy the array, effectively "moving" the array into a string.
At some point in the future I will implement an optimisation to make sure the array's memory doesn't need to be copied, but for now it's just a simple alloc + copy, and is no different than just passing the char slice to the Stringctor.
If possible, the string will be copied into the stack buffer (small string optimisation).
If it wasn't clear, arrwill have its dtor called, as the planned optimisation will require transfer of owernship of the array's underlying memory.
The string that was created from the array.