From d8525f169649e4ce7e806e68de5e328135755326 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 2 Oct 2022 19:32:25 +0200 Subject: refactor: improve management of feature specific items --- src/lib.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index b4f43fe..2cd2f03 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,6 @@ #![cfg_attr(feature = "factory", feature(unboxed_closures, fn_traits))] +#![cfg_attr(doc_cfg, feature(doc_cfg))] +#![feature(proc_macro_hygiene)] #![deny(clippy::all)] #![deny(clippy::pedantic)] #![allow(clippy::module_name_repetitions)] @@ -8,21 +10,25 @@ //! //! Syrette is a collection of utilities useful for performing dependency injection. +use feature_macros::feature_specific; + pub mod di_container; pub mod errors; pub mod interfaces; pub mod ptr; -#[cfg(feature = "async")] +#[feature_specific("async")] pub mod async_di_container; -#[cfg(feature = "async")] +#[feature_specific("async")] pub mod future; -#[cfg(feature = "async")] +#[feature_specific("async")] pub use async_di_container::AsyncDIContainer; pub use di_container::DIContainer; -pub use syrette_macros::*; +#[feature_specific("factory")] +pub use syrette_macros::{declare_default_factory, factory}; +pub use syrette_macros::{declare_interface, injectable, named}; #[cfg(feature = "factory")] #[doc(hidden)] @@ -82,8 +88,6 @@ macro_rules! di_container_bind { /// Creates a async closure. /// -/// *This macro is only available if Syrette is built with the "async" feature.* -/// /// # Examples /// ``` /// # use syrette::async_closure; @@ -118,7 +122,7 @@ macro_rules! di_container_bind { /// }) /// }); /// ``` -#[cfg(feature = "async")] +#[feature_specific("async")] #[macro_export] macro_rules! async_closure { (|$($args: ident),*| { $($inner: stmt);* }) => { -- cgit v1.2.3-18-g5258