Function format [src]
Format GUID into hexadecimal lowercase xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format
Prototype
pub fn format(self: Guid, writer: *std.Io.Writer) std.Io.Writer.Error!void
Parameters
self: Guid
writer: *std.Io.Writer
Source
pub fn format(self: Guid, writer: *std.Io.Writer) std.Io.Writer.Error!void {
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 writer.print("{x:0>8}-{x:0>4}-{x:0>4}-{x:0>2}{x:0>2}-{x:0>12}", .{
std.mem.asBytes(&time_low),
std.mem.asBytes(&time_mid),
std.mem.asBytes(&time_high_and_version),
std.mem.asBytes(&self.clock_seq_high_and_reserved),
std.mem.asBytes(&self.clock_seq_low),
std.mem.asBytes(&self.node),
});
}