Skip to main content

DisplaySimple

Derive Macro DisplaySimple 

Source
#[derive(DisplaySimple)]
Expand description

Derive macro that implements Display trait using compact JSON serialization

This generates a Display implementation that outputs the struct as compact JSON using serde_json::to_string().

ยงExample

use pretty_simple_display::DisplaySimple;
use serde::Serialize;

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

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