]>
Commit | Line | Data |
---|---|---|
ba9703b0 XL |
1 | //! Macro for opaque `Debug` trait implementation. |
2 | #![no_std] | |
3 | ||
4 | #[doc(hidden)] | |
5 | pub extern crate core as __core; | |
6 | ||
7 | /// Macro for defining opaque `Debug` implementation. | |
8 | /// | |
9 | /// It will use the following format: "StructName { ... }". While it's | |
10 | /// convinient to have it (e.g. for including into other structs), it could be | |
5099ac24 | 11 | /// undesirable to leak internall state, which can happen for example through |
ba9703b0 XL |
12 | /// uncareful logging. |
13 | #[macro_export] | |
5099ac24 | 14 | macro_rules! impl_opaque_debug { |
ba9703b0 XL |
15 | ($struct:ty) => { |
16 | impl $crate::__core::fmt::Debug for $struct { | |
17 | fn fmt(&self, f: &mut $crate::__core::fmt::Formatter) | |
18 | -> Result<(), $crate::__core::fmt::Error> | |
19 | { | |
20 | write!(f, concat!(stringify!($struct), " {{ ... }}")) | |
21 | } | |
22 | } | |
23 | } | |
24 | } |