aboutsummaryrefslogtreecommitdiff
path: root/src/provider
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/provider
parentcde9d4b41a4b37612420ac522bc261147966efa5 (diff)
refactor: rename castable factory to castable function
Diffstat (limited to 'src/provider')
-rw-r--r--src/provider/async.rs18
-rw-r--r--src/provider/blocking.rs14
2 files changed, 17 insertions, 15 deletions
diff --git a/src/provider/async.rs b/src/provider/async.rs
index 6ccb082..68eed87 100644
--- a/src/provider/async.rs
+++ b/src/provider/async.rs
@@ -17,19 +17,19 @@ pub enum AsyncProvidable<DIContainerT>
#[cfg(feature = "factory")]
Factory(
crate::ptr::ThreadsafeFactoryPtr<
- dyn crate::castable_factory::threadsafe::AnyThreadsafeCastableFactory,
+ dyn crate::castable_function::threadsafe::AnyThreadsafeCastableFunction,
>,
),
#[cfg(feature = "factory")]
DefaultFactory(
crate::ptr::ThreadsafeFactoryPtr<
- dyn crate::castable_factory::threadsafe::AnyThreadsafeCastableFactory,
+ dyn crate::castable_function::threadsafe::AnyThreadsafeCastableFunction,
>,
),
#[cfg(feature = "factory")]
AsyncDefaultFactory(
crate::ptr::ThreadsafeFactoryPtr<
- dyn crate::castable_factory::threadsafe::AnyThreadsafeCastableFactory,
+ dyn crate::castable_function::threadsafe::AnyThreadsafeCastableFunction,
>,
),
}
@@ -189,7 +189,7 @@ pub enum AsyncFactoryVariant
pub struct AsyncFactoryProvider
{
factory: crate::ptr::ThreadsafeFactoryPtr<
- dyn crate::castable_factory::threadsafe::AnyThreadsafeCastableFactory,
+ dyn crate::castable_function::threadsafe::AnyThreadsafeCastableFunction,
>,
variant: AsyncFactoryVariant,
}
@@ -199,7 +199,7 @@ impl AsyncFactoryProvider
{
pub fn new(
factory: crate::ptr::ThreadsafeFactoryPtr<
- dyn crate::castable_factory::threadsafe::AnyThreadsafeCastableFactory,
+ dyn crate::castable_function::threadsafe::AnyThreadsafeCastableFunction,
>,
variant: AsyncFactoryVariant,
) -> Self
@@ -309,14 +309,14 @@ mod tests
{
use std::any::Any;
- use crate::castable_factory::threadsafe::AnyThreadsafeCastableFactory;
- use crate::castable_factory::AnyCastableFactory;
+ use crate::castable_function::threadsafe::AnyThreadsafeCastableFunction;
+ use crate::castable_function::AnyCastableFunction;
use crate::ptr::ThreadsafeFactoryPtr;
#[derive(Debug)]
struct FooFactory;
- impl AnyCastableFactory for FooFactory
+ impl AnyCastableFunction for FooFactory
{
fn as_any(&self) -> &dyn Any
{
@@ -324,7 +324,7 @@ mod tests
}
}
- impl AnyThreadsafeCastableFactory for FooFactory {}
+ impl AnyThreadsafeCastableFunction for FooFactory {}
let factory_provider = AsyncFactoryProvider::new(
ThreadsafeFactoryPtr::new(FooFactory),
diff --git a/src/provider/blocking.rs b/src/provider/blocking.rs
index 65e315d..6475dc7 100644
--- a/src/provider/blocking.rs
+++ b/src/provider/blocking.rs
@@ -13,10 +13,10 @@ pub enum Providable<DIContainerType>
Transient(TransientPtr<dyn Injectable<DIContainerType>>),
Singleton(SingletonPtr<dyn Injectable<DIContainerType>>),
#[cfg(feature = "factory")]
- Factory(crate::ptr::FactoryPtr<dyn crate::castable_factory::AnyCastableFactory>),
+ Factory(crate::ptr::FactoryPtr<dyn crate::castable_function::AnyCastableFunction>),
#[cfg(feature = "factory")]
DefaultFactory(
- crate::ptr::FactoryPtr<dyn crate::castable_factory::AnyCastableFactory>,
+ crate::ptr::FactoryPtr<dyn crate::castable_function::AnyCastableFunction>,
),
}
@@ -110,7 +110,7 @@ where
#[cfg(feature = "factory")]
pub struct FactoryProvider
{
- factory: crate::ptr::FactoryPtr<dyn crate::castable_factory::AnyCastableFactory>,
+ factory: crate::ptr::FactoryPtr<dyn crate::castable_function::AnyCastableFunction>,
is_default_factory: bool,
}
@@ -118,7 +118,9 @@ pub struct FactoryProvider
impl FactoryProvider
{
pub fn new(
- factory: crate::ptr::FactoryPtr<dyn crate::castable_factory::AnyCastableFactory>,
+ factory: crate::ptr::FactoryPtr<
+ dyn crate::castable_function::AnyCastableFunction,
+ >,
is_default_factory: bool,
) -> Self
{
@@ -200,13 +202,13 @@ mod tests
{
use std::any::Any;
- use crate::castable_factory::AnyCastableFactory;
+ use crate::castable_function::AnyCastableFunction;
use crate::ptr::FactoryPtr;
#[derive(Debug)]
struct FooFactory;
- impl AnyCastableFactory for FooFactory
+ impl AnyCastableFunction for FooFactory
{
fn as_any(&self) -> &dyn Any
{