Expand description
§print-break
A simple debugging macro that pretty-prints variables and pauses execution. No debugger needed - just prints to stderr and waits for Enter.
§Features
- Pretty-prints any
Debugtype with syntax highlighting - Auto-detects and formats JSON, TOML, YAML strings with colors
- Shows file:line location and elapsed time between breakpoints
- Pauses execution until you press Enter
- Compiles to nothing in release builds
- Disable at runtime with
PRINT_BREAK=0 - Non-TTY safe - won’t hang in CI/piped output
§Usage
use print_break::print_break;
let x = 42;
let name = "ferris";
let json = r#"{"user": "alice", "id": 123}"#;
print_break!(x, name, json);§Environment Variables
PRINT_BREAK=0- Disable all breakpointsPRINT_BREAK=1- Enable breakpoints (default)PRINT_BREAK_DEPTH=N- Max nesting depth before collapsing (default: 4)PRINT_BREAK_STYLE=X- Border style:rounded,sharp,double,ascii
§Interactive Controls
When paused at a breakpoint:
- Enter - Continue to next breakpoint
- m - Show full output (if truncated)
- t - Show stack trace
- c - Copy value to clipboard
- s - Skip all remaining breakpoints
- q - Quit the program immediately
- h / ? - Show help
Macros§
- print_
break - Pretty-prints variables and pauses execution until Enter is pressed.
- print_
break_ if - Conditional breakpoint - only triggers if condition is true.
Structs§
- Border
Style - Border style characters
- Colors
- ANSI color codes for terminal output