confique_macro/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use proc_macro::TokenStream as TokenStream1;


mod gen;
mod ir;
mod parse;
mod util;


#[proc_macro_derive(Config, attributes(config))]
pub fn config(input: TokenStream1) -> TokenStream1 {
    syn::parse2::<syn::DeriveInput>(input.into())
        .and_then(ir::Input::from_ast)
        .map(gen::gen)
        .unwrap_or_else(|e| e.to_compile_error())
        .into()
}