Skip to main content

auto_di_macros/
lib.rs

1//! Procedural macro entrypoints for `auto-di`.
2
3use proc_macro::TokenStream;
4
5mod expansion;
6
7macro_rules! attribute {
8    ($name:ident) => {
9        #[proc_macro_attribute]
10        pub fn $name(attribute: TokenStream, item: TokenStream) -> TokenStream {
11            expansion::$name(attribute, item)
12        }
13    };
14}
15
16attribute!(singleton);
17attribute!(component);
18attribute!(service);
19attribute!(repository);
20attribute!(qualifier);
21attribute!(application);
22attribute!(configuration_properties);
23attribute!(configuration);
24attribute!(beans);
25attribute!(bean);
26
27// `service`, `repository`, and `singleton` remain compatibility aliases. New
28// code only needs `component` for constructor injection and `bean` for factory
29// injection.