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.

print

ScannedConfig.print
pub fn print(sc: *const ScannedConfig, w: *Writer) Writer.Error!void

File

lib/compiler/Maker/ScannedConfig.zig:14

Code

pub fn print(sc: *const ScannedConfig, w: *Writer) Writer.Error!void {
    std.log.err("TODO also print paths", .{});
    std.log.err("TODO also print unlazy deps", .{});
    std.log.err("TODO also print system integrations", .{});
    std.log.err("TODO also print available options", .{});
    const c = &sc.configuration;
    var serializer: Serializer = .{ .writer = w };
    var s = try serializer.beginStruct(.{});

    {
        var tf = try s.beginTupleField("search_prefixes", .{});
        for (c.search_prefixes) |string| try tf.field(string.slice(c), .{});
        try tf.end();
    }

    try s.field("default_step", @backingInt(c.default_step), .{});
    {
        var sf = try s.beginStructField("top_level_steps", .{});
        for (sc.top_level_steps.keys(), sc.top_level_steps.values()) |name, step| {
            try sf.field(name, @backingInt(step), .{});
        }
        try sf.end();
    }

    {
        var tf = try s.beginTupleField("steps", .{});
        for (c.steps) |step| {
            var step_field = try tf.beginStructField(.{});
            try printStruct(sc, &step_field, Configuration.Step, step);
            try step_field.end();
        }
        try tf.end();
    }

    try s.end();
}