add generic dump function - handy for printf debugging
This commit is contained in:
parent
87116cb69e
commit
98b0c4127f
|
@ -1324,6 +1324,14 @@ pub const Value = union(enum) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pub fn dump(value: anytype) void {
|
||||||
|
var held = std.debug.getStderrMutex().acquire();
|
||||||
|
defer held.release();
|
||||||
|
|
||||||
|
const stderr = std.io.getStdErr().writer();
|
||||||
|
std.json.stringify(value, std.json.StringifyOptions{ .whitespace = null }, stderr) catch return;
|
||||||
|
}
|
||||||
|
|
||||||
test "Value.jsonStringify" {
|
test "Value.jsonStringify" {
|
||||||
{
|
{
|
||||||
var buffer: [10]u8 = undefined;
|
var buffer: [10]u8 = undefined;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user