smart_debug_derive/
lib.rs

1#![doc = include_str!("../README.md")]
2
3use syn::{parse_macro_input, DeriveInput};
4
5mod attr;
6mod body_impl;
7mod utils;
8
9/// Derive macro for deriving [`Debug`] with easier customization
10#[proc_macro_derive(SmartDebug, attributes(debug))]
11pub fn derive_smart_debug(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
12    let input = parse_macro_input!(input as DeriveInput);
13    match body_impl::impl_derive(&input) {
14        Ok(output) => output.into(),
15        Err(err) => err.to_compile_error().into(),
16    }
17}