| ... | ... | @@ -1289,35 +1289,7 @@ pub const Value = union(enum) { |
| 1289 | 1289 | defer held.release(); |
| 1290 | 1290 | |
| 1291 | 1291 | const stderr = std.debug.getStderrStream(); |
| 1292 | | self.dumpStream(stderr, 1024) catch return; |
| 1293 | | } |
| 1294 | | |
| 1295 | | pub fn dumpIndent(self: Value, comptime indent: usize) void { |
| 1296 | | if (indent == 0) { |
| 1297 | | self.dump(); |
| 1298 | | } else { |
| 1299 | | var held = std.debug.getStderrMutex().acquire(); |
| 1300 | | defer held.release(); |
| 1301 | | |
| 1302 | | const stderr = std.debug.getStderrStream(); |
| 1303 | | self.dumpStreamIndent(indent, stderr, 1024) catch return; |
| 1304 | | } |
| 1305 | | } |
| 1306 | | |
| 1307 | | pub fn dumpStream(self: @This(), stream: var, comptime max_depth: usize) !void { |
| 1308 | | var w = std.json.WriteStream(@TypeOf(stream).Child, max_depth).init(stream); |
| 1309 | | w.newline = ""; |
| 1310 | | w.one_indent = ""; |
| 1311 | | w.space = ""; |
| 1312 | | try w.emitJson(self); |
| 1313 | | } |
| 1314 | | |
| 1315 | | pub fn dumpStreamIndent(self: @This(), comptime indent: usize, stream: var, comptime max_depth: usize) !void { |
| 1316 | | var one_indent = " " ** indent; |
| 1317 | | |
| 1318 | | var w = std.json.WriteStream(@TypeOf(stream).Child, max_depth).init(stream); |
| 1319 | | w.one_indent = one_indent; |
| 1320 | | try w.emitJson(self); |
| 1292 | std.json.stringify(self, std.json.StringifyOptions{ .whitespace = null }, stderr) catch return; |
| 1321 | 1293 | } |
| 1322 | 1294 | }; |
| 1323 | 1295 | |