Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

printTaggedUnion

ScannedConfig.printTaggedUnion
fn printTaggedUnion(sc: *const ScannedConfig, s: *Serializer, value: anytype) !void

File

lib/compiler/Maker/ScannedConfig.zig:173

Code

fn printTaggedUnion(sc: *const ScannedConfig, s: *Serializer, value: anytype) !void {
    switch (value) {
        inline else => |u, tag| {
            if (@TypeOf(u) == void) {
                try s.ident(@tagName(tag));
            } else {
                var sub_struct = try s.beginStruct(.{});
                try sub_struct.fieldPrefix(@tagName(tag));
                try printValue(sc, s, @TypeOf(u), u);
                try sub_struct.end();
            }
        },
    }
}