diff options
Diffstat (limited to 'src/interfaces/async_injectable.rs')
-rw-r--r-- | src/interfaces/async_injectable.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/interfaces/async_injectable.rs b/src/interfaces/async_injectable.rs index fb7f8ba..4e614a3 100644 --- a/src/interfaces/async_injectable.rs +++ b/src/interfaces/async_injectable.rs @@ -2,6 +2,7 @@ use std::fmt::Debug; use std::sync::Arc; +use crate::dependency_history::IDependencyHistory; use crate::di_container::asynchronous::IAsyncDIContainer; use crate::errors::injectable::InjectableError; use crate::future::BoxFuture; @@ -9,9 +10,10 @@ use crate::libs::intertrait::CastFromSync; use crate::ptr::TransientPtr; /// Interface for structs that can be injected into or be injected to. -pub trait AsyncInjectable<DIContainerType>: CastFromSync +pub trait AsyncInjectable<DIContainerType, DependencyHistoryType>: CastFromSync where - DIContainerType: IAsyncDIContainer, + DIContainerType: IAsyncDIContainer<DependencyHistoryType>, + DependencyHistoryType: IDependencyHistory + Send + Sync, { /// Resolves the dependencies of the injectable. /// @@ -19,16 +21,18 @@ where /// Will return `Err` if resolving the dependencies fails. fn resolve<'di_container, 'fut>( di_container: &'di_container Arc<DIContainerType>, - dependency_history: Vec<&'static str>, + dependency_history: DependencyHistoryType, ) -> BoxFuture<'fut, Result<TransientPtr<Self>, InjectableError>> where Self: Sized + 'fut, 'di_container: 'fut; } -impl<DIContainerType> Debug for dyn AsyncInjectable<DIContainerType> +impl<DIContainerType, DependencyHistoryType> Debug + for dyn AsyncInjectable<DIContainerType, DependencyHistoryType> where - DIContainerType: IAsyncDIContainer, + DIContainerType: IAsyncDIContainer<DependencyHistoryType>, + DependencyHistoryType: IDependencyHistory + Send + Sync, { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |