Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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 standard library. Private Constant

PackageInstanceMap

Private Constant
std.Build.PackageInstanceMap
const PackageInstanceMap = std.array_hash_map.Custom(PackageInstanceKey, *Dependency, struct

File

Build.zig:241
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
const PackageInstanceMap = std.array_hash_map.Custom(PackageInstanceKey, *Dependency, struct {
    pub fn hash(_: @This(), k: PackageInstanceKey) u32 {
        var hasher = std.hash.Wyhash.init(0);
        hasher.update(k.pkg_hash);
        for (k.options.keys(), k.options.values()) |option_key, option_value| {
            hasher.update(option_key);
            option_value.hash(&hasher);
        }
        return @truncate(hasher.final());
    }

    pub fn eql(_: @This(), a: PackageInstanceKey, b: PackageInstanceKey, _: usize) bool {
        if (!mem.eql(u8, a.pkg_hash, b.pkg_hash)) return false;
        if (a.options.count() != b.options.count()) return false;
        for (
            a.options.keys(),
            b.options.keys(),
            a.options.values(),
            b.options.values(),
        ) |a_key, b_key, a_val, b_val| {
            if (!mem.eql(u8, a_key, b_key)) return false;
            if (!a_val.eql(b_val)) return false;
        }
        return true;
    }
}, true)