123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- use proc_macro::TokenStream;
- use quote::quote;
- mod entity;
- mod index;
- mod modelable;
- fn parse_microrm_ref(attrs: &[syn::Attribute]) -> proc_macro2::TokenStream {
- for attr in attrs {
- if attr.path.segments.is_empty() {
- continue;
- }
- if attr.tokens.is_empty() && attr.path.segments.last().unwrap().ident == "microrm_internal"
- {
- return quote! { crate };
- }
- }
- quote! { ::microrm }
- }
- #[proc_macro_derive(Entity, attributes(microrm_internal, microrm_foreign))]
- pub fn derive_entity(tokens: TokenStream) -> TokenStream {
- entity::derive(tokens)
- }
- #[proc_macro_derive(Modelable, attributes(microrm_internal))]
- pub fn derive_modelable(tokens: TokenStream) -> TokenStream {
- modelable::derive(tokens)
- }
- #[proc_macro]
- pub fn make_index(tokens: TokenStream) -> TokenStream {
- index::do_make_index(tokens, quote! { ::microrm })
- }
- #[proc_macro]
- pub fn make_index_internal(tokens: TokenStream) -> TokenStream {
- index::do_make_index(tokens, quote! { crate })
- }
|