structstd.Build.Cache.Path.TableAdapter[src]

Useful to make Path a key in std.ArrayHashMap.

Container Types

Functions

Functionhash[src]

pub fn hash(self: TableAdapter, a: Cache.Path) u32

Parameters

Source Code

Source code
pub fn hash(self: TableAdapter, a: Cache.Path) u32 {
    _ = self;
    const seed = switch (@typeInfo(@TypeOf(a.root_dir.handle.fd))) {
        .pointer => @intFromPtr(a.root_dir.handle.fd),
        .int => @as(u32, @bitCast(a.root_dir.handle.fd)),
        else => @compileError("unimplemented hash function"),
    };
    return @truncate(Hash.hash(seed, a.sub_path));
}

Functioneql[src]

pub fn eql(self: TableAdapter, a: Cache.Path, b: Cache.Path, b_index: usize) bool

Parameters

b_index: usize

Source Code

Source code
pub fn eql(self: TableAdapter, a: Cache.Path, b: Cache.Path, b_index: usize) bool {
    _ = self;
    _ = b_index;
    return a.eql(b);
}

Source Code

Source code
pub const TableAdapter = struct {
    pub const Hash = std.hash.Wyhash;

    pub fn hash(self: TableAdapter, a: Cache.Path) u32 {
        _ = self;
        const seed = switch (@typeInfo(@TypeOf(a.root_dir.handle.fd))) {
            .pointer => @intFromPtr(a.root_dir.handle.fd),
            .int => @as(u32, @bitCast(a.root_dir.handle.fd)),
            else => @compileError("unimplemented hash function"),
        };
        return @truncate(Hash.hash(seed, a.sub_path));
    }
    pub fn eql(self: TableAdapter, a: Cache.Path, b: Cache.Path, b_index: usize) bool {
        _ = self;
        _ = b_index;
        return a.eql(b);
    }
}