Skip to main content

todotxt_tui_macros/
lib.rs

1extern crate proc_macro;
2
3mod impl_conf;
4mod impl_conf_functions;
5mod impl_conf_merge;
6
7use proc_macro::TokenStream;
8
9const CONF_OPTION: &str = "ConfOption";
10
11#[proc_macro_derive(Conf, attributes(arg))]
12pub fn conf_derive(input: TokenStream) -> TokenStream {
13    let ast: syn::DeriveInput = syn::parse(input).expect("Syn cannot parse Conf macro input");
14    impl_conf::impl_conf(&ast).into()
15}
16
17#[proc_macro_derive(ConfMerge, attributes(command, export_option))]
18pub fn conf_merge_derive(input: TokenStream) -> TokenStream {
19    let ast: syn::DeriveInput = syn::parse(input).expect("Syn cannot parse ConfMerge macro input");
20    impl_conf_merge::impl_conf_merge(&ast).into()
21}