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.
Zig › std/ › Build.zig › typeToEnum
typeToEnum
Build.typeToEnum
fn typeToEnum (comptime T : type ) Configuration .AvailableOption .Type
File
Code
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 )),
},
};
}