Function printHex [src]
Prototype
pub fn printHex(w: *Writer, bytes: []const u8, case: std.fmt.Case) Error!void
Parameters
w: *Writer
bytes: []const u8
case: std.fmt.Case
Possible Errors
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]);
}
}