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.

load

Manifest.load
pub fn load(
    io: Io,
    arena: Allocator,
    manifest_path: std.Build.Cache.Path,
    ast: *std.zig.Ast,
    error_bundle: *std.zig.ErrorBundle.Wip,
    manifest: *Manifest,
    allow_missing_paths_field: bool,
) !void

File

Code

pub fn load(
    io: Io,
    arena: Allocator,
    manifest_path: std.Build.Cache.Path,
    ast: *std.zig.Ast,
    error_bundle: *std.zig.ErrorBundle.Wip,
    manifest: *Manifest,
    allow_missing_paths_field: bool,
) !void {
    const manifest_bytes = try manifest_path.root_dir.handle.readFileAllocOptions(
        io,
        manifest_path.sub_path,
        arena,
        .limited(max_bytes),
        .@"1",
        0,
    );

    ast.* = try std.zig.Ast.parse(arena, manifest_bytes, .{ .mode = .zon });

    if (ast.errors.len > 0) {
        const file_path = try manifest_path.joinString(arena, "");
        try std.zig.putAstErrorsIntoBundle(arena, ast.*, file_path, error_bundle);
        return error.ErrorsBundled;
    }

    const rng: std.Random.IoSource = .{ .io = io };

    manifest.* = try parse(arena, ast, rng.interface(), .{
        .allow_missing_paths_field = allow_missing_paths_field,
    });

    if (manifest.errors.len > 0) {
        const src_path = try error_bundle.printString("{f}", .{manifest_path});
        try manifest.copyErrorsIntoBundle(ast.*, src_path, error_bundle);
        return error.ErrorsBundled;
    }
}