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.

Linkage

Builder.Linkage
pub const Linkage = enum(u4)

File

lib/std/zig/llvm/Builder.zig:1794

Code

pub const Linkage = enum(u4) {
    private = 9,
    internal = 3,
    weak = 1,
    weak_odr = 10,
    linkonce = 4,
    linkonce_odr = 11,
    available_externally = 12,
    appending = 2,
    common = 8,
    extern_weak = 7,
    external = 0,

    pub fn format(self: Linkage, w: *Writer) Writer.Error!void {
        if (self != .external) try w.print(" {s}", .{@tagName(self)});
    }

    fn formatOptional(data: ?Linkage, w: *Writer) Writer.Error!void {
        if (data) |linkage| try w.print(" {s}", .{@tagName(linkage)});
    }
    pub fn fmtOptional(self: ?Linkage) std.fmt.Alt(?Linkage, formatOptional) {
        return .{ .data = self };
    }
}