aboutsummaryrefslogtreecommitdiff
path: root/src/di_container/asynchronous
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-07-11 21:00:09 +0200
committerHampusM <hampus@hampusmat.com>2024-07-11 21:00:09 +0200
commit20d37eb93060e51970d3791c6c173e07ef5ad489 (patch)
tree0c08e74cacdedfe10273f5db69aeaed06e37a03b /src/di_container/asynchronous
parentcde9d4b41a4b37612420ac522bc261147966efa5 (diff)
refactor: rename castable factory to castable function
Diffstat (limited to 'src/di_container/asynchronous')
-rw-r--r--src/di_container/asynchronous/binding/builder.rs16
-rw-r--r--src/di_container/asynchronous/mod.rs20
2 files changed, 18 insertions, 18 deletions
diff --git a/src/di_container/asynchronous/binding/builder.rs b/src/di_container/asynchronous/binding/builder.rs
index f42e6a1..8465c9a 100644
--- a/src/di_container/asynchronous/binding/builder.rs
+++ b/src/di_container/asynchronous/binding/builder.rs
@@ -173,7 +173,7 @@ where
Interface: Fn<Args, Output = Return> + Send + Sync,
FactoryFunc: Fn(&AsyncDIContainer) -> BoxFn<Args, Return> + Send + Sync,
{
- use crate::castable_factory::threadsafe::ThreadsafeCastableFactory;
+ use crate::castable_function::threadsafe::ThreadsafeCastableFunction;
use crate::provider::r#async::AsyncFactoryVariant;
if self
@@ -186,7 +186,7 @@ where
)));
}
- let factory_impl = ThreadsafeCastableFactory::new(factory_func);
+ let factory_impl = ThreadsafeCastableFunction::new(factory_func);
self.di_container.set_binding::<Interface>(
BindingOptions::new(),
@@ -270,7 +270,7 @@ where
+ Send
+ Sync,
{
- use crate::castable_factory::threadsafe::ThreadsafeCastableFactory;
+ use crate::castable_function::threadsafe::ThreadsafeCastableFunction;
use crate::provider::r#async::AsyncFactoryVariant;
if self
@@ -283,7 +283,7 @@ where
)));
}
- let factory_impl = ThreadsafeCastableFactory::new(factory_func);
+ let factory_impl = ThreadsafeCastableFunction::new(factory_func);
self.di_container.set_binding::<Interface>(
BindingOptions::new(),
@@ -354,7 +354,7 @@ where
+ Send
+ Sync,
{
- use crate::castable_factory::threadsafe::ThreadsafeCastableFactory;
+ use crate::castable_function::threadsafe::ThreadsafeCastableFunction;
use crate::provider::r#async::AsyncFactoryVariant;
if self
@@ -367,7 +367,7 @@ where
)));
}
- let factory_impl = ThreadsafeCastableFactory::new(factory_func);
+ let factory_impl = ThreadsafeCastableFunction::new(factory_func);
self.di_container.set_binding::<Interface>(
BindingOptions::new(),
@@ -445,7 +445,7 @@ where
+ Send
+ Sync,
{
- use crate::castable_factory::threadsafe::ThreadsafeCastableFactory;
+ use crate::castable_function::threadsafe::ThreadsafeCastableFunction;
use crate::provider::r#async::AsyncFactoryVariant;
if self
@@ -458,7 +458,7 @@ where
)));
}
- let factory_impl = ThreadsafeCastableFactory::new(factory_func);
+ let factory_impl = ThreadsafeCastableFunction::new(factory_func);
self.di_container.set_binding::<Interface>(
BindingOptions::new(),
diff --git a/src/di_container/asynchronous/mod.rs b/src/di_container/asynchronous/mod.rs
index 3e29ef6..c993b8b 100644
--- a/src/di_container/asynchronous/mod.rs
+++ b/src/di_container/asynchronous/mod.rs
@@ -348,11 +348,11 @@ impl AsyncDIContainer
}
#[cfg(feature = "factory")]
AsyncProvidable::Factory(factory_binding) => {
- use crate::castable_factory::threadsafe::ThreadsafeCastableFactory;
+ use crate::castable_function::threadsafe::ThreadsafeCastableFunction;
let factory = factory_binding
.as_any()
- .downcast_ref::<ThreadsafeCastableFactory<Interface, Self>>()
+ .downcast_ref::<ThreadsafeCastableFunction<Interface, Self>>()
.ok_or_else(|| AsyncDIContainerError::CastFailed {
interface: type_name::<Interface>(),
binding_kind: "factory",
@@ -362,10 +362,10 @@ impl AsyncDIContainer
}
#[cfg(feature = "factory")]
AsyncProvidable::DefaultFactory(binding) => {
- use crate::castable_factory::threadsafe::ThreadsafeCastableFactory;
+ use crate::castable_function::threadsafe::ThreadsafeCastableFunction;
use crate::ptr::TransientPtr;
- type DefaultFactoryFn<Interface> = ThreadsafeCastableFactory<
+ type DefaultFactoryFn<Interface> = ThreadsafeCastableFunction<
dyn Fn() -> TransientPtr<Interface> + Send + Sync,
AsyncDIContainer,
>;
@@ -382,11 +382,11 @@ impl AsyncDIContainer
}
#[cfg(feature = "factory")]
AsyncProvidable::AsyncDefaultFactory(binding) => {
- use crate::castable_factory::threadsafe::ThreadsafeCastableFactory;
+ use crate::castable_function::threadsafe::ThreadsafeCastableFunction;
use crate::future::BoxFuture;
use crate::ptr::TransientPtr;
- type AsyncDefaultFactoryFn<Interface> = ThreadsafeCastableFactory<
+ type AsyncDefaultFactoryFn<Interface> = ThreadsafeCastableFunction<
dyn Fn<(), Output = BoxFuture<'static, TransientPtr<Interface>>>
+ Send
+ Sync,
@@ -652,7 +652,7 @@ mod tests
}
}
- use crate::castable_factory::threadsafe::ThreadsafeCastableFactory;
+ use crate::castable_function::threadsafe::ThreadsafeCastableFunction;
type IUserManagerFactory =
dyn Fn(Vec<i128>) -> TransientPtr<dyn IUserManager> + Send + Sync;
@@ -674,7 +674,7 @@ mod tests
inner_mock_provider.expect_provide().returning(|_, _| {
Ok(AsyncProvidable::Factory(
crate::ptr::ThreadsafeFactoryPtr::new(
- ThreadsafeCastableFactory::new(factory_func),
+ ThreadsafeCastableFunction::new(factory_func),
),
))
});
@@ -734,7 +734,7 @@ mod tests
}
}
- use crate::castable_factory::threadsafe::ThreadsafeCastableFactory;
+ use crate::castable_function::threadsafe::ThreadsafeCastableFunction;
type IUserManagerFactory =
dyn Fn(Vec<i128>) -> TransientPtr<dyn IUserManager> + Send + Sync;
@@ -756,7 +756,7 @@ mod tests
inner_mock_provider.expect_provide().returning(|_, _| {
Ok(AsyncProvidable::Factory(
crate::ptr::ThreadsafeFactoryPtr::new(
- ThreadsafeCastableFactory::new(factory_func),
+ ThreadsafeCastableFunction::new(factory_func),
),
))
});