asActiveField

Gets a wrapper struct with a toString method to format the provided smart union.

SmartUnionFormatter!(SU)
asActiveField
(
SU
)
(,
bool include_name = false
)

Parameters

SU

type of smart union to get formatting wrapper for

smart_union SU

smart union to get formatting wrapper for

include_name bool

flag to toggle formatting of the name of the active union member. If true, format output will look like "<activename>: value". If false, format output will look like "value"

Examples

union U
{
    int i;
    cstring s;
}

SmartUnion!(U) su;

// format from ocean.text.convert.Formatter
format("union active member: {}", asActiveField(su));

Meta