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