authorgravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2023-05-20 22:18:25+01:00
committergravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2023-05-25 20:17:07+01:00
log7860cd734ce1227b3e96e4829de8929d546f78e8
treea32d8c9bf759cc7de6540642bb7ea8b91548e8ef
parent230ea411f72303607a8c5c5467258eee61bd6939

std.fmt: Rename Alignment enum values to snake case


1 files changed, 11 insertions(+), 11 deletions(-)

lib/std/fmt.zig+11-11
...@@ -14,15 +14,15 @@ const expectFmt = std.testing.expectFmt;...@@ -14,15 +14,15 @@ const expectFmt = std.testing.expectFmt;
14pub const default_max_depth = 3;14pub const default_max_depth = 3;
1515
16pub const Alignment = enum {16pub const Alignment = enum {
17 Left,17 left,
18 Center,18 center,
19 Right,19 right,
20};20};
2121
22pub const FormatOptions = struct {22pub const FormatOptions = struct {
23 precision: ?usize = null,23 precision: ?usize = null,
24 width: ?usize = null,24 width: ?usize = null,
25 alignment: Alignment = .Right,25 alignment: Alignment = .right,
26 fill: u8 = ' ',26 fill: u8 = ' ',
27};27};
2828
...@@ -252,11 +252,11 @@ pub const Placeholder = struct {...@@ -252,11 +252,11 @@ pub const Placeholder = struct {
252 else => {},252 else => {},
253 }253 }
254 break :init switch (ch) {254 break :init switch (ch) {
255 '<' => .Left,255 '<' => .left,
256 '^' => .Center,256 '^' => .center,
257 else => .Right,257 else => .right,
258 };258 };
259 } else .Right;259 } else .right;
260260
261 // Parse the width parameter261 // Parse the width parameter
262 const width = comptime parser.specifier() catch |err|262 const width = comptime parser.specifier() catch |err|
...@@ -1034,18 +1034,18 @@ pub fn formatBuf(...@@ -1034,18 +1034,18 @@ pub fn formatBuf(
1034 return writer.writeAll(buf);1034 return writer.writeAll(buf);
10351035
1036 switch (options.alignment) {1036 switch (options.alignment) {
1037 .Left => {1037 .left => {
1038 try writer.writeAll(buf);1038 try writer.writeAll(buf);
1039 try writer.writeByteNTimes(options.fill, padding);1039 try writer.writeByteNTimes(options.fill, padding);
1040 },1040 },
1041 .Center => {1041 .center => {
1042 const left_padding = padding / 2;1042 const left_padding = padding / 2;
1043 const right_padding = (padding + 1) / 2;1043 const right_padding = (padding + 1) / 2;
1044 try writer.writeByteNTimes(options.fill, left_padding);1044 try writer.writeByteNTimes(options.fill, left_padding);
1045 try writer.writeAll(buf);1045 try writer.writeAll(buf);
1046 try writer.writeByteNTimes(options.fill, right_padding);1046 try writer.writeByteNTimes(options.fill, right_padding);
1047 },1047 },
1048 .Right => {1048 .right => {
1049 try writer.writeByteNTimes(options.fill, padding);1049 try writer.writeByteNTimes(options.fill, padding);
1050 try writer.writeAll(buf);1050 try writer.writeAll(buf);
1051 },1051 },