Skip to main content

impl_json_debug_pretty

Macro impl_json_debug_pretty 

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

Implements Debug as indented JSON for one or more Serialize types.

Expands to an impl std::fmt::Debug per type that delegates to write_json_pretty.

use optionstratlib_core::impl_json_debug_pretty;
use serde::Serialize;

#[derive(Serialize)]
struct Fill {
    qty: u32,
}
impl_json_debug_pretty!(Fill);

assert_eq!(format!("{:?}", Fill { qty: 3 }), "{\n  \"qty\": 3\n}");