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.

tags

Given an enum or error set type, returns a pointer to an array containing all tags for that enum or error set.

meta.tags
pub fn tags(comptime T: type) *const [fieldNames(T).len]T

File

lib/std/meta.zig:369

Code

pub fn tags(comptime T: type) *const [fieldNames(T).len]T {
    return comptime blk: {
        const field_names = fieldNames(T);
        var res: [field_names.len]T = undefined;
        for (field_names, 0..) |field_name, i| {
            res[i] = @field(T, field_name);
        }
        const final = res;
        break :blk &final;
    };
}