From a34f7c03779aaf90f34b5ff59587daf1db42de8d Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 15 Sep 2024 23:02:34 +0200 Subject: refactor: rename factory provider to function provider --- src/di_container/asynchronous/binding/builder.rs | 40 ++++++++++++++---------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'src/di_container/asynchronous') 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 + Send + Sync, FactoryFunc: Fn(&AsyncDIContainer) -> BoxFn + 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::( 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::( 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::( 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::( 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, )), ); -- cgit v1.2.3-18-g5258