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.

builderToPackage

Serialize.builderToPackage
fn builderToPackage(s: *Serialize, b: *std.Build) !Configuration.Package.Index

File

lib/std/Build/Serialize.zig:720

Code

fn builderToPackage(s: *Serialize, b: *std.Build) !Configuration.Package.Index {
    if (b.pkg_hash.len == 0) return .root;
    const arena = s.arena;
    const wc = s.wc;
    const gop = try s.package_map.getOrPut(arena, b);
    if (!gop.found_existing) {
        gop.value_ptr.* = try wc.addExtra(Configuration.Package, .{
            .hash = try wc.addString(b.pkg_hash),
            .dep_prefix = try wc.addString(b.dep_prefix),
            .root_path = try wc.addString(try b.root.toString(arena)),
        });
    }
    return gop.value_ptr.*;
}