1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
extern crate proc_macro;

mod structural_convert;

use syn::parse_macro_input;
use syn::DeriveInput;

use crate::proc_macro::TokenStream;

#[proc_macro_derive(StructuralConvert, attributes(convert, convert2))]
pub fn structural_convert(item: TokenStream) -> TokenStream {
    structural_convert::structural_convert_impl(parse_macro_input!(item as DeriveInput))
        .unwrap_or_else(syn::Error::into_compile_error)
        .into()
}