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 Asn1ParserContext.preserveString

1
2
3
4
5
module juptune.asn1.lang.common;

String preserveString(
    const char[] slice
);

Documentation

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.

Notes

The returned value should never outlive this context instance's lifetime.

Params

Returns

The copied slice, in the form of a String.

Override Functions Asn1ParserContext.preserveString

1
2
3
4
5

Documentation

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.