From 4fd0d6b4951b08a20d5378bca75561109dc6d036 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 18 Sep 2023 22:35:58 +0200 Subject: refactor!: make the async DI container not inside a Arc BREAKING CHANGE: The async DI container is no longer inside of a Arc. This affects AsyncBindingBuilder, AsyncBindingScopeConfigurator, AsyncBindingWhenConfigurator & AsyncInjectable --- src/provider/async.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/provider') diff --git a/src/provider/async.rs b/src/provider/async.rs index ae633fd..2bf7be1 100644 --- a/src/provider/async.rs +++ b/src/provider/async.rs @@ -1,5 +1,4 @@ use std::marker::PhantomData; -use std::sync::Arc; use async_trait::async_trait; @@ -43,7 +42,7 @@ where { async fn provide( &self, - di_container: &Arc, + di_container: &DIContainerT, dependency_history: DependencyHistory, ) -> Result, InjectableError>; @@ -90,7 +89,7 @@ where { async fn provide( &self, - di_container: &Arc, + di_container: &DIContainerT, dependency_history: DependencyHistory, ) -> Result, InjectableError> { @@ -150,7 +149,7 @@ where { async fn provide( &self, - _di_container: &Arc, + _di_container: &DIContainerT, _dependency_history: DependencyHistory, ) -> Result, InjectableError> { @@ -217,7 +216,7 @@ where { async fn provide( &self, - _di_container: &Arc, + _di_container: &DIContainerT, _dependency_history: DependencyHistory, ) -> Result, InjectableError> { @@ -273,7 +272,7 @@ mod tests assert!( matches!( transient_type_provider - .provide(&Arc::new(di_container), MockDependencyHistory::new()) + .provide(&di_container, MockDependencyHistory::new()) .await?, AsyncProvidable::Transient(_) ), @@ -298,7 +297,7 @@ mod tests assert!( matches!( singleton_provider - .provide(&Arc::new(di_container), MockDependencyHistory::new()) + .provide(&di_container, MockDependencyHistory::new()) .await?, AsyncProvidable::Singleton(_) ), @@ -335,7 +334,7 @@ mod tests AsyncFactoryVariant::AsyncDefault, ); - let di_container = Arc::new(MockAsyncDIContainer::new()); + let di_container = MockAsyncDIContainer::new(); assert!( matches!( -- cgit v1.2.3-18-g5258