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.

CLASS

elf.CLASS
pub const CLASS = enum(u8)

File

lib/std/elf.zig:1639

Code

pub const CLASS = enum(u8) {
    NONE = 0,
    @"32" = 1,
    @"64" = 2,
    _,

    pub const NUM = @typeInfo(CLASS).@"enum".field_names.len;

    pub inline fn size(class: CLASS) u8 {
        return switch (class) {
            .NONE, _ => unreachable,
            .@"32" => 4,
            .@"64" => 8,
        };
    }

    pub fn ElfN(comptime class: CLASS) type {
        return switch (class) {
            .NONE, _ => comptime unreachable,
            .@"32" => Elf32,
            .@"64" => Elf64,
        };
    }
}