| ... | @@ -17,7 +17,7 @@ pub const Alignment = enum { | ... | @@ -17,7 +17,7 @@ pub const Alignment = enum { |
| 17 | pub const FormatOptions = struct { | 17 | pub const FormatOptions = struct { |
| 18 | precision: ?usize = null, | 18 | precision: ?usize = null, |
| 19 | width: ?usize = null, | 19 | width: ?usize = null, |
| 20 | alignment: ?Alignment = null, | 20 | alignment: Alignment = .Left, |
| 21 | fill: u8 = ' ', | 21 | fill: u8 = ' ', |
| 22 | }; | 22 | }; |
| 23 | | 23 | |
| ... | @@ -596,10 +596,9 @@ pub fn formatBuf( | ... | @@ -596,10 +596,9 @@ pub fn formatBuf( |
| 596 | out_stream: var, | 596 | out_stream: var, |
| 597 | ) !void { | 597 | ) !void { |
| 598 | const width = options.width orelse buf.len; | 598 | const width = options.width orelse buf.len; |
| 599 | const alignment = options.alignment orelse .Left; | | |
| 600 | var padding = if (width > buf.len) (width - buf.len) else 0; | 599 | var padding = if (width > buf.len) (width - buf.len) else 0; |
| 601 | const pad_byte = [1]u8{options.fill}; | 600 | const pad_byte = [1]u8{options.fill}; |
| 602 | switch (alignment) { | 601 | switch (options.alignment) { |
| 603 | .Left => { | 602 | .Left => { |
| 604 | try out_stream.writeAll(buf); | 603 | try out_stream.writeAll(buf); |
| 605 | while (padding > 0) : (padding -= 1) { | 604 | while (padding > 0) : (padding -= 1) { |