1#![allow(
6 clippy::missing_const_for_fn, clippy::std_instead_of_core, clippy::std_instead_of_alloc, clippy::alloc_instead_of_core, )]
11
12mod smart_display {
14 pub(crate) mod delegate;
15 pub(crate) mod private_metadata;
16}
17
18use proc_macro::TokenStream;
19
20macro_rules! attribute {
22 ($($mod:ident)::+ => $public:ident) => {
23 #[doc = concat!("The `#[", attribute!(@stringify $($mod)+), "]` attribute.")]
24 #[proc_macro_attribute]
25 pub fn $public(attr: TokenStream, item: TokenStream) -> TokenStream {
26 match $($mod)::+::implementation(attr.into(), item.into()) {
27 Ok(ts) => ts.into(),
28 Err(err) => err.to_compile_error().into(),
29 }
30 }
31 };
32 (@stringify $first:ident $($remaining:ident)*) => {
33 concat!(stringify!($first), $("::", stringify!($remaining),)*)
34 };
35}
36
37attribute!(smart_display::delegate => smart_display_delegate);
38attribute!(smart_display::private_metadata => smart_display_private_metadata);