dbgfmt
A zero-dependency Rust library and CLI tool that pretty-prints Rust Debug trait output with proper indentation and newlines.
Example
Input:
Foo { bar: 1, baz: Vec { items: [1, 2, 3] }, name: "hello" }
Output:
Foo {
bar: 1,
baz: Vec {
items: [
1,
2,
3,
],
},
name: "hello",
}
As a Library
Add to your Cargo.toml:
[]
= "0.1"
Use in your code:
use format_debug;
let input = format!;
let pretty = format_debug;
println!;
As a CLI
Installation
Homebrew
Shell script
|
Cargo
Usage
# Pass as argument
# Pipe from stdin
|
# Format dbg!() macro output (prefix is preserved)
|
# Multiple values (separate lines or same line)
|
# Best-effort format broken/truncated input
License
Licensed under either of
at your option.