| ... | ... | @@ -33,8 +33,7 @@ pub const Item = union(enum) { |
| 33 | 33 | try writer.writeAll("Item{"); |
| 34 | 34 | switch (self) { |
| 35 | 35 | .event => { |
| 36 | | // try std.fmt.format(writer, "{s}", .{@tagName(self.event.type)}); |
| 37 | | try std.fmt.format(writer, "event {d}", .{self.event}); |
| 36 | try std.fmt.format(writer, "event {}", .{self.event}); |
| 38 | 37 | }, |
| 39 | 38 | .kv, .document, .stream => { |
| 40 | 39 | unreachable; |
| ... | ... | @@ -114,8 +113,8 @@ pub const Mapping = struct { |
| 114 | 113 | return null; |
| 115 | 114 | } |
| 116 | 115 | |
| 117 | | pub fn get_string(self: Mapping, k: string) string { |
| 118 | | return if (self.get(k)) |v| v.string else ""; |
| 116 | pub fn get_string(self: Mapping, k: string) ?string { |
| 117 | return self.getT(k, .string); |
| 119 | 118 | } |
| 120 | 119 | |
| 121 | 120 | pub fn get_string_array(self: Mapping, alloc: std.mem.Allocator, k: string) ![]string { |
| ... | ... | @@ -134,6 +133,10 @@ pub const Mapping = struct { |
| 134 | 133 | return list.toOwnedSlice(); |
| 135 | 134 | } |
| 136 | 135 | |
| 136 | pub fn getMap(self: Mapping, k: string) ?Mapping { |
| 137 | return self.getT(k, .mapping); |
| 138 | } |
| 139 | |
| 137 | 140 | pub fn format(self: Mapping, comptime fmt: string, options: std.fmt.FormatOptions, writer: anytype) @TypeOf(writer).Error!void { |
| 138 | 141 | _ = fmt; |
| 139 | 142 | _ = options; |