Marmos
v juptune
v asn1
v lang
v ast
v Classes
v Enums
v ir
v parser
v Enums
v Structs
v core
v crypto
v keyexchange
v memory
v data
v alphabet
v buffer
v json
v builder
v parser
v Enums
v Structs
v serialise
v Structs
v Templates
v pem
v Enums
v Structs

Functions String.fromDestroyingArray

1
2
3
4
5
6
7
module juptune.core.ds.string;

String fromDestroyingArray(
    ArrayT
)(
    ArrayT arr
);

Documentation

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.

Notes

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.

Params

Returns

The string that was created from the array.