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.

scanForDebian

Distro.scanForDebian
fn scanForDebian(buf: []const u8) Tag

File

Code

fn scanForDebian(buf: []const u8) Tag {
    var it = mem.splitScalar(u8, buf, '.');
    if (std.fmt.parseInt(u8, it.next().?, 10)) |major| {
        return switch (major) {
            5 => .debian_lenny,
            6 => .debian_squeeze,
            7 => .debian_wheezy,
            8 => .debian_jessie,
            9 => .debian_stretch,
            10 => .debian_buster,
            11 => .debian_bullseye,
            12 => .debian_bookworm,
            13 => .debian_trixie,
            else => .unknown,
        };
    } else |_| {}

    it = mem.splitScalar(u8, buf, '\n');
    const name = it.next().?;
    if (mem.eql(u8, name, "squeeze/sid")) return .debian_squeeze;
    if (mem.eql(u8, name, "wheezy/sid")) return .debian_wheezy;
    if (mem.eql(u8, name, "jessie/sid")) return .debian_jessie;
    if (mem.eql(u8, name, "stretch/sid")) return .debian_stretch;
    if (mem.eql(u8, name, "buster/sid")) return .debian_buster;
    if (mem.eql(u8, name, "bullseye/sid")) return .debian_bullseye;
    if (mem.eql(u8, name, "bookworm/sid")) return .debian_bookworm;

    return .unknown;
}