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.

computedPackageHash

Fetch.computedPackageHash
pub fn computedPackageHash(f: *const Fetch) Package.Hash

File

lib/compiler/Maker/Fetch.zig:841

Code

pub fn computedPackageHash(f: *const Fetch) Package.Hash {
    const saturated_size = std.math.cast(u32, f.computed_hash.total_size) orelse std.math.maxInt(u32);
    if (f.have_manifest) {
        const man = &f.manifest;
        var version_buffer: [32]u8 = undefined;
        const version: []const u8 = std.fmt.bufPrint(&version_buffer, "{f}", .{man.version}) catch &version_buffer;
        return .init(f.computed_hash.digest, man.name, version, man.id, saturated_size);
    }
    // In the future build.zig.zon fields will be added to allow overriding these values
    // for naked tarballs.
    return .init(f.computed_hash.digest, "N", "V", 0xffff, saturated_size);
}