Skip to main content

DebugPretty

Derive Macro DebugPretty 

Source
#[derive(DebugPretty)]
Expand description

Derive macro that implements Debug trait using pretty JSON serialization

This generates a Debug implementation that outputs the struct as pretty-printed JSON using serde_json::to_string_pretty().

ยงExample

use pretty_simple_display::DebugPretty;
use serde::Serialize;

#[derive(Serialize, DebugPretty)]
struct User {
    id: u64,
    name: String,
}

let user = User { id: 1, name: "Alice".to_string() };
println!("{:?}", user); // Pretty-printed JSON