12345module juptune.asn1.lang.common;
String preserveString(
const char[] slice
);
Creates a copy of the given string, and ties its lifetime with this context instance.
This is helpful for @nogc use cases, since you can: Load in a string; call this function to ensure it has the correct lifetime; free the previously loaded string, and finally use the copied version of the string for any actual parsing.
The alternative is that @nogc user code would have to guarentee that source code strings do not get freed before a context instance.
The returned value should never outlive this context instance's lifetime.
The copied slice, in the form of a String.
12345module juptune.asn1.lang.common;
void preserveString(
String str
);
An overload of preserveStringthat doesn't create a copy, but instead preserves a living instance of str, so that its ref count doesn't reach 0 until sometime after this context instance is destroyed.