Function format [src]

Format GUID into hexadecimal lowercase xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format

Prototype

pub fn format( self: @This(), comptime f: []const u8, options: std.fmt.FormatOptions, writer: anytype, ) !void

Parameters

self: @This()f: []const u8options: std.fmt.FormatOptions

Source

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); } }