add generic dump function - handy for printf debugging
This commit is contained in:
		
							parent
							
								
									87116cb69e
								
							
						
					
					
						commit
						98b0c4127f
					
				
					 1 changed files with 8 additions and 0 deletions
				
			
		|  | @ -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" { | ||||
|     { | ||||
|         var buffer: [10]u8 = undefined; | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue