extern struct Guid [src]

GUIDs are align(8) unless otherwise specified.

Fields

time_low: u32
time_mid: u16
time_high_and_version: u16
clock_seq_high_and_reserved: u8
clock_seq_low: u8
node: [6]u8

Members

Source

pub const Guid = extern struct { time_low: u32, time_mid: u16, time_high_and_version: u16, clock_seq_high_and_reserved: u8, clock_seq_low: u8, node: [6]u8, /// Format GUID into hexadecimal lowercase xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format pub fn format( self: @This(), comptime f: []const u8, options: std.fmt.FormatOptions, writer: anytype, ) !void { _ = options; if (f.len == 0) { const fmt = std.fmt.fmtSliceHexLower; const time_low = @byteSwap(self.time_low); const time_mid = @byteSwap(self.time_mid); const time_high_and_version = @byteSwap(self.time_high_and_version); return std.fmt.format(writer, "{:0>8}-{:0>4}-{:0>4}-{:0>2}{:0>2}-{:0>12}", .{ fmt(std.mem.asBytes(&time_low)), fmt(std.mem.asBytes(&time_mid)), fmt(std.mem.asBytes(&time_high_and_version)), fmt(std.mem.asBytes(&self.clock_seq_high_and_reserved)), fmt(std.mem.asBytes(&self.clock_seq_low)), fmt(std.mem.asBytes(&self.node)), }); } else { std.fmt.invalidFmtError(f, self); } } pub fn eql(a: std.os.uefi.Guid, b: std.os.uefi.Guid) bool { return a.time_low == b.time_low and a.time_mid == b.time_mid and a.time_high_and_version == b.time_high_and_version and a.clock_seq_high_and_reserved == b.clock_seq_high_and_reserved and a.clock_seq_low == b.clock_seq_low and std.mem.eql(u8, &a.node, &b.node); } }