aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/injectable.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/injectable.rs')
-rw-r--r--src/interfaces/injectable.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/interfaces/injectable.rs b/src/interfaces/injectable.rs
index 132935d..6130d2b 100644
--- a/src/interfaces/injectable.rs
+++ b/src/interfaces/injectable.rs
@@ -2,15 +2,17 @@
use std::fmt::Debug;
use std::rc::Rc;
+use crate::dependency_history::IDependencyHistory;
use crate::di_container::blocking::IDIContainer;
use crate::errors::injectable::InjectableError;
use crate::libs::intertrait::CastFrom;
use crate::ptr::TransientPtr;
/// Interface for structs that can be injected into or be injected to.
-pub trait Injectable<DIContainerType>: CastFrom
+pub trait Injectable<DIContainerType, DependencyHistoryType>: CastFrom
where
- DIContainerType: IDIContainer,
+ DIContainerType: IDIContainer<DependencyHistoryType>,
+ DependencyHistoryType: IDependencyHistory,
{
/// Resolves the dependencies of the injectable.
///
@@ -18,15 +20,17 @@ where
/// Will return `Err` if resolving the dependencies fails.
fn resolve(
di_container: &Rc<DIContainerType>,
- dependency_history: Vec<&'static str>,
+ dependency_history: DependencyHistoryType,
) -> Result<TransientPtr<Self>, InjectableError>
where
Self: Sized;
}
-impl<DIContainerType> Debug for dyn Injectable<DIContainerType>
+impl<DIContainerType, DependencyHistoryType> Debug
+ for dyn Injectable<DIContainerType, DependencyHistoryType>
where
- DIContainerType: IDIContainer,
+ DIContainerType: IDIContainer<DependencyHistoryType>,
+ DependencyHistoryType: IDependencyHistory,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
{