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.

Extended

Step.Extended
pub const Extended = union(enum)

File

Code

pub const Extended = union(enum) {
    check_file: CheckFile,
    compile: Compile,
    config_header: ConfigHeader,
    fail: Fail,
    find_program: FindProgram,
    fmt: Fmt,
    install_artifact: InstallArtifact,
    install_dir: InstallDir,
    install_file: InstallFile,
    obj_copy: ObjCopy,
    options: Options,
    run: Run,
    top_level: TopLevel,
    translate_c: TranslateC,
    update_source_files: UpdateSourceFiles,
    write_file: WriteFile,

    pub fn init(tag: Configuration.Step.Tag) Extended {
        return switch (tag) {
            .check_file => .{ .check_file = .{} },
            .compile => .{ .compile = .{} },
            .config_header => .{ .config_header = .{} },
            .fail => .{ .fail = .{} },
            .find_program => .{ .find_program = .{} },
            .fmt => .{ .fmt = .{} },
            .install_artifact => .{ .install_artifact = .{} },
            .install_dir => .{ .install_dir = .{} },
            .install_file => .{ .install_file = .{} },
            .obj_copy => .{ .obj_copy = .{} },
            .options => .{ .options = .{} },
            .run => .{ .run = .{} },
            .top_level => .{ .top_level = .{} },
            .translate_c => .{ .translate_c = .{} },
            .update_source_files => .{ .update_source_files = .{} },
            .write_file => .{ .write_file = .{} },
        };
    }

    pub const TopLevel = struct {
        pub fn make(
            top_level: *TopLevel,
            step_index: Configuration.Step.Index,
            maker: *Maker,
            progress_node: std.Progress.Node,
        ) Step.ExtendedMakeError!void {
            _ = top_level;
            _ = step_index;
            _ = maker;
            _ = progress_node;
        }
    };

    pub const Fail = struct {
        pub fn make(
            this: *@This(),
            step_index: Configuration.Step.Index,
            maker: *Maker,
            progress_node: std.Progress.Node,
        ) Step.ExtendedMakeError!void {
            _ = this;
            _ = progress_node;
            const graph = maker.graph;
            const arena = graph.arena; // TODO don't leak into the process arena
            const conf = &maker.scanned_config.configuration;
            const step = maker.stepByIndex(step_index);
            const conf_step = step_index.ptr(conf);
            const conf_fail = conf_step.extended.get(conf.extra).fail;

            try step.result_error_msgs.append(arena, conf_fail.msg.slice(conf));
            return error.MakeFailed;
        }
    };
}