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.

pkgHashFromBuildZig

Build.pkgHashFromBuildZig
fn pkgHashFromBuildZig(comptime build_zig: type) ?[]const u8

File

lib/std/Build.zig:2250

Code

fn pkgHashFromBuildZig(comptime build_zig: type) ?[]const u8 {
    const deps = @import("root").dependencies;
    return comptime for (@typeInfo(deps.packages).@"struct".decl_names) |pkg_hash| {
        const pkg = @field(deps.packages, pkg_hash);
        if (@hasDecl(pkg, "build_zig") and pkg.build_zig == build_zig) break pkg_hash;
    } else null;
}