pyoe2_craftpath/utils/debug_display_macro.rs
1#[macro_export]
2macro_rules! derive_DebugDisplay {
3 ($($t:ident),+ $(,)?) => {
4 $(
5 impl std::fmt::Display for $t {
6 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7 match serde_json::to_string_pretty(self) {
8 Ok(json) => write!(f, "{}", json),
9 Err(e) => write!(f, "<failed to serialize {}: {}>\nPrinting raw Rust debug string: {:#?}", stringify!($t), e, self),
10 }
11 }
12 }
13 )+
14 };
15}