Crate print_break

Crate print_break 

Source
Expand description

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 Debug type
  • Auto-detects and formats JSON, TOML, YAML strings
  • Shows file:line location
  • Pauses execution until you press Enter
  • Compiles to nothing in release builds
  • Disable at runtime with PRINT_BREAK=0
  • Interactive: Enter=continue, q=quit, s=skip remaining

§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 breakpoints
  • PRINT_BREAK=1 - Enable breakpoints (default)
  • PRINT_BREAK_DEPTH=N - Max nesting depth before collapsing (default: 4)

§Interactive Controls

When paused at a breakpoint:

  • Enter - Continue to next breakpoint
  • q - Quit the program immediately
  • s - Skip all remaining breakpoints

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§

BorderStyle
Border style characters
Colors
ANSI color codes for terminal output