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 standard library.
std › Build › typeToEnum Private Function typeToEnum Doc Source 1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438 fn typeToEnum (comptime T : type ) Configuration .AvailableOption .Type {
return switch (T ) {
std .zig .BuildId => .build_id ,
LazyPath => .lazy_path ,
else => return switch (@typeInfo (T )) {
.int => .int ,
.float => .float ,
.bool => .bool ,
.@"enum" => .@"enum" ,
.pointer => |pointer | switch (pointer .child ) {
u8 => .string ,
[]const u8 => .list ,
LazyPath => .lazy_path_list ,
else => switch (@typeInfo (pointer .child )) {
.@"enum" => .enum_list ,
else => @compileError ("Unsupported type: " ++ @typeName (T )),
},
},
else => @compileError ("Unsupported type: " ++ @typeName (T )),
},
};
}