Function printHex [src]

Prototype

pub fn printHex(w: *Writer, bytes: []const u8, case: std.fmt.Case) Error!void

Parameters

w: *Writerbytes: []const u8case: std.fmt.Case

Possible Errors

WriteFailed

See the Writer implementation for detailed diagnostics.

Source

pub fn printHex(w: *Writer, bytes: []const u8, case: std.fmt.Case) Error!void { const charset = switch (case) { .upper => "0123456789ABCDEF", .lower => "0123456789abcdef", }; for (bytes) |c| { try w.writeByte(charset[c >> 4]); try w.writeByte(charset[c & 15]); } }