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/di_container.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/di_container.rs') diff --git a/src/di_container.rs b/src/di_container.rs index 7ccfd3f..7743be8 100644 --- a/src/di_container.rs +++ b/src/di_container.rs @@ -54,6 +54,8 @@ use std::cell::RefCell; use std::marker::PhantomData; use std::rc::Rc; +use feature_macros::feature_specific; + #[cfg(feature = "factory")] use crate::castable_factory::blocking::CastableFactory; use crate::di_container_binding_map::DIContainerBindingMap; @@ -271,8 +273,6 @@ where /// Creates a binding of factory type `Interface` to a factory inside of the /// associated [`DIContainer`]. /// - /// *This function is only available if Syrette is built with the "factory" feature.* - /// /// # Errors /// Will return Err if the associated [`DIContainer`] already have a binding for /// the interface. @@ -333,7 +333,7 @@ where /// # Ok(()) /// # } /// ``` - #[cfg(feature = "factory")] + #[feature_specific("factory")] pub fn to_factory( &self, factory_func: &'static dyn Fn< @@ -375,8 +375,6 @@ where /// Creates a binding of type `Interface` to a factory that takes no arguments /// inside of the associated [`DIContainer`]. /// - /// *This function is only available if Syrette is built with the "factory" feature.* - /// /// # Errors /// Will return Err if the associated [`DIContainer`] already have a binding for /// the interface. @@ -424,7 +422,7 @@ where /// # Ok(()) /// # } /// ``` - #[cfg(feature = "factory")] + #[feature_specific("factory")] pub fn to_default_factory( &self, factory_func: &'static FactoryFunc, -- cgit v1.2.3-18-g5258