diff options
author | HampusM <hampus@hampusmat.com> | 2023-08-05 23:14:06 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-08-05 23:14:06 +0200 |
commit | 89c238f9c82ade2d7656e2bee76838a391609a88 (patch) | |
tree | 8771a893a9c83b06715c3af0fa2da3cd206b0716 /src/di_container/blocking/binding/when_configurator.rs | |
parent | ddc666c55eec968f9a99408f3e3ad0f92d932179 (diff) |
refactor!: remove IDependencyHistory
BREAKING CHANGE: IDependencyHistory has been removed as part of an effort to simplify the API. This affects IDIContainer, DIContainer, IAsyncDIContainer, AsyncDIContainer, Injectable, AsyncInjectable, BindingBuilder, AsyncBindingBuilder, BindingScopeConfigurator, BindingWhenConfigurator, AsyncBindingScopeConfigurator, AsyncBindingWhenConfigurator and DependencyHistory
Diffstat (limited to 'src/di_container/blocking/binding/when_configurator.rs')
-rw-r--r-- | src/di_container/blocking/binding/when_configurator.rs | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/di_container/blocking/binding/when_configurator.rs b/src/di_container/blocking/binding/when_configurator.rs index 31b1b48..fcef377 100644 --- a/src/di_container/blocking/binding/when_configurator.rs +++ b/src/di_container/blocking/binding/when_configurator.rs @@ -5,38 +5,32 @@ use std::any::type_name; use std::marker::PhantomData; use std::rc::Rc; -use crate::dependency_history::IDependencyHistory; use crate::di_container::blocking::IDIContainer; use crate::errors::di_container::BindingWhenConfiguratorError; /// When configurator for a binding for type `Interface` inside a [`IDIContainer`]. /// /// [`IDIContainer`]: crate::di_container::blocking::IDIContainer -pub struct BindingWhenConfigurator<Interface, DIContainerType, DependencyHistoryType> +pub struct BindingWhenConfigurator<Interface, DIContainerType> where Interface: 'static + ?Sized, - DIContainerType: IDIContainer<DependencyHistoryType>, - DependencyHistoryType: IDependencyHistory, + DIContainerType: IDIContainer, { di_container: Rc<DIContainerType>, interface_phantom: PhantomData<Interface>, - dependency_history_phantom: PhantomData<DependencyHistoryType>, } -impl<Interface, DIContainerType, DependencyHistoryType> - BindingWhenConfigurator<Interface, DIContainerType, DependencyHistoryType> +impl<Interface, DIContainerType> BindingWhenConfigurator<Interface, DIContainerType> where Interface: 'static + ?Sized, - DIContainerType: IDIContainer<DependencyHistoryType>, - DependencyHistoryType: IDependencyHistory, + DIContainerType: IDIContainer, { pub(crate) fn new(di_container: Rc<DIContainerType>) -> Self { Self { di_container, interface_phantom: PhantomData, - dependency_history_phantom: PhantomData, } } @@ -97,8 +91,7 @@ mod tests let binding_when_configurator = BindingWhenConfigurator::< dyn subjects::INumber, - mocks::blocking_di_container::MockDIContainer<mocks::MockDependencyHistory>, - mocks::MockDependencyHistory, + mocks::blocking_di_container::MockDIContainer, >::new(Rc::new(di_container_mock)); assert!(binding_when_configurator.when_named("cool").is_ok()); |