diff options
author | HampusM <hampus@hampusmat.com> | 2023-09-18 22:35:58 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-09-18 22:35:58 +0200 |
commit | 4fd0d6b4951b08a20d5378bca75561109dc6d036 (patch) | |
tree | 8496d679e7ee3debcd415ed563911e2166594212 /src/provider | |
parent | de2e1349f459f7f69226b2decd366be690426ea7 (diff) |
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
Diffstat (limited to 'src/provider')
-rw-r--r-- | src/provider/async.rs | 15 |
1 files changed, 7 insertions, 8 deletions
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<DIContainerT>, + di_container: &DIContainerT, dependency_history: DependencyHistory, ) -> Result<AsyncProvidable<DIContainerT>, InjectableError>; @@ -90,7 +89,7 @@ where { async fn provide( &self, - di_container: &Arc<DIContainerT>, + di_container: &DIContainerT, dependency_history: DependencyHistory, ) -> Result<AsyncProvidable<DIContainerT>, InjectableError> { @@ -150,7 +149,7 @@ where { async fn provide( &self, - _di_container: &Arc<DIContainerT>, + _di_container: &DIContainerT, _dependency_history: DependencyHistory, ) -> Result<AsyncProvidable<DIContainerT>, InjectableError> { @@ -217,7 +216,7 @@ where { async fn provide( &self, - _di_container: &Arc<DIContainerT>, + _di_container: &DIContainerT, _dependency_history: DependencyHistory, ) -> Result<AsyncProvidable<DIContainerT>, 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!( |