Skip to main content

impl_json_debug

Macro impl_json_debug 

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

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

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

use optionstratlib_core::impl_json_debug;
use serde::Serialize;

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

assert_eq!(format!("{:?}", Fill { qty: 3 }), r#"{"qty":3}"#);