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.

fieldTypes

meta.fieldTypes
pub fn fieldTypes(comptime T: type) []const type

File

lib/std/meta.zig:340

Code

pub fn fieldTypes(comptime T: type) []const type {
    return switch (@typeInfo(T)) {
        .@"struct" => |s| s.field_types,
        .@"union" => |u| u.field_types,
        else => @compileError("Expected struct or union type, found '" ++ @typeName(T) ++ "'"),
    };
}