diff options
Diffstat (limited to 'src/interfaces/injectable.rs')
-rw-r--r-- | src/interfaces/injectable.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/interfaces/injectable.rs b/src/interfaces/injectable.rs index f4c7fda..132935d 100644 --- a/src/interfaces/injectable.rs +++ b/src/interfaces/injectable.rs @@ -2,27 +2,31 @@ use std::fmt::Debug; use std::rc::Rc; +use crate::di_container::blocking::IDIContainer; use crate::errors::injectable::InjectableError; use crate::libs::intertrait::CastFrom; use crate::ptr::TransientPtr; -use crate::DIContainer; /// Interface for structs that can be injected into or be injected to. -pub trait Injectable: CastFrom +pub trait Injectable<DIContainerType>: CastFrom +where + DIContainerType: IDIContainer, { /// Resolves the dependencies of the injectable. /// /// # Errors /// Will return `Err` if resolving the dependencies fails. fn resolve( - di_container: &Rc<DIContainer>, + di_container: &Rc<DIContainerType>, dependency_history: Vec<&'static str>, ) -> Result<TransientPtr<Self>, InjectableError> where Self: Sized; } -impl Debug for dyn Injectable +impl<DIContainerType> Debug for dyn Injectable<DIContainerType> +where + DIContainerType: IDIContainer, { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |