aboutsummaryrefslogtreecommitdiff
path: root/src/di_container/asynchronous/binding/builder.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-09-15 23:02:34 +0200
committerHampusM <hampus@hampusmat.com>2024-09-15 23:22:33 +0200
commita34f7c03779aaf90f34b5ff59587daf1db42de8d (patch)
treed5a2f057b70932e44999fd0f2389811fad5a4478 /src/di_container/asynchronous/binding/builder.rs
parentb655d0e439da0da468e02d394e1189c5603fe752 (diff)
refactor: rename factory provider to function provider
Diffstat (limited to 'src/di_container/asynchronous/binding/builder.rs')
-rw-r--r--src/di_container/asynchronous/binding/builder.rs40
1 files changed, 24 insertions, 16 deletions
diff --git a/src/di_container/asynchronous/binding/builder.rs b/src/di_container/asynchronous/binding/builder.rs
index 8465c9a..833517b 100644
--- a/src/di_container/asynchronous/binding/builder.rs
+++ b/src/di_container/asynchronous/binding/builder.rs
@@ -173,8 +173,10 @@ where
Interface: Fn<Args, Output = Return> + Send + Sync,
FactoryFunc: Fn(&AsyncDIContainer) -> BoxFn<Args, Return> + Send + Sync,
{
+ use std::sync::Arc;
+
use crate::castable_function::threadsafe::ThreadsafeCastableFunction;
- use crate::provider::r#async::AsyncFactoryVariant;
+ use crate::provider::r#async::ProvidableFunctionKind;
if self
.di_container
@@ -190,9 +192,9 @@ where
self.di_container.set_binding::<Interface>(
BindingOptions::new(),
- Box::new(crate::provider::r#async::AsyncFactoryProvider::new(
- crate::ptr::ThreadsafeFactoryPtr::new(factory_impl),
- AsyncFactoryVariant::Normal,
+ Box::new(crate::provider::r#async::AsyncFunctionProvider::new(
+ Arc::new(factory_impl),
+ ProvidableFunctionKind::UserCalled,
)),
);
@@ -270,8 +272,10 @@ where
+ Send
+ Sync,
{
+ use std::sync::Arc;
+
use crate::castable_function::threadsafe::ThreadsafeCastableFunction;
- use crate::provider::r#async::AsyncFactoryVariant;
+ use crate::provider::r#async::ProvidableFunctionKind;
if self
.di_container
@@ -287,9 +291,9 @@ where
self.di_container.set_binding::<Interface>(
BindingOptions::new(),
- Box::new(crate::provider::r#async::AsyncFactoryProvider::new(
- crate::ptr::ThreadsafeFactoryPtr::new(factory_impl),
- AsyncFactoryVariant::Normal,
+ Box::new(crate::provider::r#async::AsyncFunctionProvider::new(
+ Arc::new(factory_impl),
+ ProvidableFunctionKind::UserCalled,
)),
);
@@ -354,8 +358,10 @@ where
+ Send
+ Sync,
{
+ use std::sync::Arc;
+
use crate::castable_function::threadsafe::ThreadsafeCastableFunction;
- use crate::provider::r#async::AsyncFactoryVariant;
+ use crate::provider::r#async::ProvidableFunctionKind;
if self
.di_container
@@ -371,9 +377,9 @@ where
self.di_container.set_binding::<Interface>(
BindingOptions::new(),
- Box::new(crate::provider::r#async::AsyncFactoryProvider::new(
- crate::ptr::ThreadsafeFactoryPtr::new(factory_impl),
- AsyncFactoryVariant::Default,
+ Box::new(crate::provider::r#async::AsyncFunctionProvider::new(
+ Arc::new(factory_impl),
+ ProvidableFunctionKind::Instant,
)),
);
@@ -445,8 +451,10 @@ where
+ Send
+ Sync,
{
+ use std::sync::Arc;
+
use crate::castable_function::threadsafe::ThreadsafeCastableFunction;
- use crate::provider::r#async::AsyncFactoryVariant;
+ use crate::provider::r#async::ProvidableFunctionKind;
if self
.di_container
@@ -462,9 +470,9 @@ where
self.di_container.set_binding::<Interface>(
BindingOptions::new(),
- Box::new(crate::provider::r#async::AsyncFactoryProvider::new(
- crate::ptr::ThreadsafeFactoryPtr::new(factory_impl),
- AsyncFactoryVariant::AsyncDefault,
+ Box::new(crate::provider::r#async::AsyncFunctionProvider::new(
+ Arc::new(factory_impl),
+ ProvidableFunctionKind::AsyncInstant,
)),
);