Function printFloatHexOptions [src]
Uses a smaller stack buffer; asserts mode is not decimal or scientific.
Prototype
pub fn printFloatHexOptions(w: *Writer, value: anytype, options: std.fmt.Number) Error!void
Parameters
w: *Writer
options: std.fmt.Number
Possible Errors
See the Writer
implementation for detailed diagnostics.
Source
pub fn printFloatHexOptions(w: *Writer, value: anytype, options: std.fmt.Number) Error!void {
var buf: [50]u8 = undefined; // for aligning
var sub_writer: Writer = .fixed(&buf);
switch (options.mode) {
.decimal => unreachable,
.scientific => unreachable,
.binary => @panic("TODO"),
.octal => @panic("TODO"),
.hex => {},
}
printFloatHex(&sub_writer, value, options.case, options.precision) catch unreachable; // buf is large enough
const printed = sub_writer.buffered();
return w.alignBuffer(printed, options.width orelse printed.len, options.alignment, options.fill);
}