Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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. Public Function

format

Public Function
std.zig.llvm.Builder.Metadata.Subprogram.DISPFlags.format
pub fn format(self: DISPFlags, w: *Writer) Writer.Error!void

Params

File

zig/llvm/Builder.zig:9402
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
            pub fn format(self: DISPFlags, w: *Writer) Writer.Error!void {
                var need_pipe = false;
                const info = @typeInfo(DISPFlags).@"struct";
                inline for (info.field_names, info.field_types) |field_name, field_type| {
                    switch (@typeInfo(field_type)) {
                        .bool => if (@field(self, field_name)) {
                            if (need_pipe) try w.writeAll(" | ") else need_pipe = true;
                            try w.print("DISPFlag{s}", .{field_name});
                        },
                        .@"enum" => if (@field(self, field_name) != .Zero) {
                            if (need_pipe) try w.writeAll(" | ") else need_pipe = true;
                            try w.print("DISPFlag{s}", .{@tagName(@field(self, field_name))});
                        },
                        .int => assert(@field(self, field_name) == 0),
                        else => @compileError("bad field type: " ++ field_name ++ ": " ++
                            @typeName(field_type)),
                    }
                }
                if (!need_pipe) try w.writeByte('0');
            }