1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
extern crate proc_macro; #[macro_use] mod utils; mod create; mod define; use proc_macro2::Ident; use proc_macro_hack::proc_macro_hack; fn ident_builder(ty: &Ident) -> Ident { let ident = format!("_Factori_Builder_{}", ty); Ident::new(&ident, ty.span()) } fn ident_features_enum(ty: &Ident) -> Ident { let ident = format!("_Factori_Features_{}", ty); Ident::new(&ident, ty.span()) } #[proc_macro] pub fn factori(input: proc_macro::TokenStream) -> proc_macro::TokenStream { define::define_macro(input.into()).into() } #[proc_macro_hack] pub fn create(input: proc_macro::TokenStream) -> proc_macro::TokenStream { create::create_macro(input.into()).into() }