diff options
Diffstat (limited to 'macros/src')
-rw-r--r-- | macros/src/lib.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/macros/src/lib.rs b/macros/src/lib.rs index fc30016..8e906d0 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -1,3 +1,5 @@ +#![cfg_attr(doc_cfg, feature(doc_cfg))] +#![feature(proc_macro_hygiene)] #![deny(clippy::all)] #![deny(clippy::pedantic)] #![allow(clippy::module_name_repetitions)] @@ -5,6 +7,7 @@ //! Macros for the [Syrette](https://crates.io/crates/syrette) crate. +use feature_macros::feature_specific; use proc_macro::TokenStream; use quote::quote; use syn::{parse, parse_macro_input}; @@ -15,10 +18,10 @@ mod libs; mod macro_flag; mod util; -#[cfg(feature = "factory")] +#[feature_specific("factory")] mod factory; -#[cfg(feature = "factory")] +#[feature_specific("factory")] mod fn_trait; use crate::declare_interface_args::DeclareInterfaceArgs; @@ -156,8 +159,6 @@ pub fn injectable(args_stream: TokenStream, impl_stream: TokenStream) -> TokenSt /// /// The return type is automatically put inside of a [`TransientPtr`]. /// -/// *This macro is only available if Syrette is built with the "factory" feature.* -/// /// # Arguments /// * (Zero or more) Flags. Like `a = true, b = false` /// @@ -192,8 +193,8 @@ pub fn injectable(args_stream: TokenStream, impl_stream: TokenStream) -> TokenSt /// ``` /// /// [`TransientPtr`]: https://docs.rs/syrette/latest/syrette/ptr/type.TransientPtr.html +#[feature_specific("factory")] #[proc_macro_attribute] -#[cfg(feature = "factory")] pub fn factory(args_stream: TokenStream, type_alias_stream: TokenStream) -> TokenStream { use quote::ToTokens; @@ -267,8 +268,6 @@ pub fn factory(args_stream: TokenStream, type_alias_stream: TokenStream) -> Toke /// Another way to accomplish what this macro does would be by using /// the [`macro@factory`] macro. /// -/// *This macro is only available if Syrette is built with the "factory" feature.* -/// /// # Arguments /// - Interface trait /// * (Zero or more) Flags. Like `a = true, b = false` @@ -292,7 +291,7 @@ pub fn factory(args_stream: TokenStream, type_alias_stream: TokenStream) -> Toke /// declare_default_factory!(dyn IParser); /// ``` #[proc_macro] -#[cfg(feature = "factory")] +#[feature_specific("factory")] pub fn declare_default_factory(args_stream: TokenStream) -> TokenStream { use syn::parse_str; |