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.access

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

auto access(
    RetT
)(
    RetT function(
        const char[]
    ) accessor
);

Documentation

A safer-ish way to access the underlying slice, by forcing it to go through a scoped delegate.

This should be preferred over String.slicewhen the underlying slice needs to be accessed, as it helps to ensure that the slice is not leaked.

Notes

Under the hood this function calls slice, which will force the string to become allocated on the heap if small string optimization is in use. This is extra security to help prevent stack corruption.

Params

Returns

Anything returned by the accessor delegate if RetTis not void.

Override Functions String.access

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

auto access(
    RetT
)(
    RetT function(
        const char[]
    ) accessor
);