extern struct File [src]

Fields

directory_index: u32
basename: String

Members

Source

pub const File = extern struct { directory_index: u32, basename: String, pub const Index = enum(u32) { invalid = std.math.maxInt(u32), _, }; pub const MapContext = struct { string_bytes: []const u8, pub fn hash(self: MapContext, a: File) u32 { const a_basename = span(self.string_bytes[@intFromEnum(a.basename)..]); return @truncate(Hash.hash(a.directory_index, a_basename)); } pub fn eql(self: MapContext, a: File, b: File, b_index: usize) bool { _ = b_index; if (a.directory_index != b.directory_index) return false; const a_basename = span(self.string_bytes[@intFromEnum(a.basename)..]); const b_basename = span(self.string_bytes[@intFromEnum(b.basename)..]); return std.mem.eql(u8, a_basename, b_basename); } }; pub const SliceAdapter = struct { string_bytes: []const u8, pub const Entry = struct { directory_index: u32, basename: []const u8, }; pub fn hash(self: @This(), a: Entry) u32 { _ = self; return @truncate(Hash.hash(a.directory_index, a.basename)); } pub fn eql(self: @This(), a: Entry, b: File, b_index: usize) bool { _ = b_index; if (a.directory_index != b.directory_index) return false; const b_basename = span(self.string_bytes[@intFromEnum(b.basename)..]); return std.mem.eql(u8, a.basename, b_basename); } }; }