From 9e01cdf341a7866180b3a63d745f3b2d7578d28a Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 23 Oct 2022 18:12:23 +0200 Subject: refactor!: reduce DI container coupling BREAKING CHANGE: You now have to import the DI containers's interfaces to use the DI containers's methods --- src/interfaces/async_injectable.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/interfaces/async_injectable.rs') diff --git a/src/interfaces/async_injectable.rs b/src/interfaces/async_injectable.rs index dadb603..fb7f8ba 100644 --- a/src/interfaces/async_injectable.rs +++ b/src/interfaces/async_injectable.rs @@ -2,21 +2,23 @@ use std::fmt::Debug; use std::sync::Arc; +use crate::di_container::asynchronous::IAsyncDIContainer; use crate::errors::injectable::InjectableError; use crate::future::BoxFuture; use crate::libs::intertrait::CastFromSync; use crate::ptr::TransientPtr; -use crate::AsyncDIContainer; /// Interface for structs that can be injected into or be injected to. -pub trait AsyncInjectable: CastFromSync +pub trait AsyncInjectable: CastFromSync +where + DIContainerType: IAsyncDIContainer, { /// Resolves the dependencies of the injectable. /// /// # Errors /// Will return `Err` if resolving the dependencies fails. fn resolve<'di_container, 'fut>( - di_container: &'di_container Arc, + di_container: &'di_container Arc, dependency_history: Vec<&'static str>, ) -> BoxFuture<'fut, Result, InjectableError>> where @@ -24,7 +26,9 @@ pub trait AsyncInjectable: CastFromSync 'di_container: 'fut; } -impl Debug for dyn AsyncInjectable +impl Debug for dyn AsyncInjectable +where + DIContainerType: IAsyncDIContainer, { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { -- cgit v1.2.3-18-g5258