]> git.proxmox.com Git - rustc.git/blob - vendor/opaque-debug/src/lib.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / vendor / opaque-debug / src / lib.rs
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
11 /// undesirable to leak internal state, which can happen for example through
12 /// uncareful logging.
13 #[macro_export]
14 macro_rules! implement {
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 }