Macro impl_json_display

Source
macro_rules! impl_json_display {
    ($($t:ty),+) => { ... };
}
Expand description

Implements the Display trait for a type by serializing it to JSON

This macro automatically implements the Display trait for one or more types by serializing them to JSON using serde_json. This is useful for debugging and logging purposes.

ยงExamples

use tracing::info;
use ig_client::impl_json_display;

#[derive(serde::Serialize)]
struct MyStruct {
    field1: String,
    field2: i32,
}

impl_json_display!(MyStruct);

let my_struct = MyStruct {
    field1: "value".to_string(),
    field2: 42,
};

info!("{}", my_struct); // Outputs JSON representation