authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-08 14:49:38 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-08 14:49:38 -07:00
logdff9fd43ebf1046c70090bdccfeb2e4f1c0d584b
tree5b25281717c556d85b4d4ce7f07326ac5136fb6b
parentd7b9055564a14a5d0453ff050f73096e76a604ca
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

add nprint methods for nio.fmt


1 files changed, 17 insertions(+), 2 deletions(-)

yaml.zig+17-2
......@@ -56,7 +56,11 @@ pub const Item = union(enum) {
5656 }
5757 }
5858
59 pub fn format(self: Item, writer: *std.Io.Writer) !void {
59 pub fn format(self: Value, writer: *std.Io.Writer) !void {
60 return nprint(self, writer);
61 }
62
63 pub fn nprint(self: Item, writer: anytype) !void {
6064 try writer.writeAll("Item{");
6165 switch (self) {
6266 .event => {
......@@ -119,6 +123,10 @@ pub const Value = union(enum) {
119123 }
120124
121125 pub fn format(self: Value, writer: *std.Io.Writer) !void {
126 return nprint(self, writer);
127 }
128
129 pub fn nprint(self: Value, writer: anytype) !void {
122130 try writer.writeAll("Value{");
123131 switch (self) {
124132 .string => {
......@@ -134,6 +142,9 @@ pub const Value = union(enum) {
134142 }
135143 try writer.writeAll("]");
136144 },
145 .anchor => {
146 //
147 },
137148 }
138149 try writer.writeAll("}");
139150 }
......@@ -189,7 +200,11 @@ pub const Mapping = struct {
189200 return self.getT(k, .mapping);
190201 }
191202
192 pub fn format(self: Mapping, writer: *std.Io.Writer) !void {
203 pub fn format(self: Value, writer: *std.Io.Writer) !void {
204 return nprint(self, writer);
205 }
206
207 pub fn nprint(self: Mapping, writer: anytype) !void {
193208 try writer.writeAll("{ ");
194209 for (self.items) |it| {
195210 try writer.print("{s}: ", .{it.key});