aboutsummaryrefslogtreecommitdiff
path: root/src/di_container
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-11-19 15:45:12 +0100
committerHampusM <hampus@hampusmat.com>2022-11-19 15:45:12 +0100
commit9f27a925bd323e8e0864bedeb33a3c6953517ea1 (patch)
treeea5d8faaed82c58fa037fa377173bb365e1cd697 /src/di_container
parentd99cbf9fa95856cbc14a3217e1cd3f13aeb2e0b3 (diff)
refactor: reorganize non-public API items
Diffstat (limited to 'src/di_container')
-rw-r--r--src/di_container/asynchronous/binding/builder.rs8
-rw-r--r--src/di_container/asynchronous/mod.rs17
-rw-r--r--src/di_container/blocking/binding/builder.rs4
-rw-r--r--src/di_container/blocking/mod.rs11
4 files changed, 21 insertions, 19 deletions
diff --git a/src/di_container/asynchronous/binding/builder.rs b/src/di_container/asynchronous/binding/builder.rs
index 3ea8a35..8ba5be3 100644
--- a/src/di_container/asynchronous/binding/builder.rs
+++ b/src/di_container/asynchronous/binding/builder.rs
@@ -191,7 +191,7 @@ where
FactoryFunc:
Fn<(Arc<DIContainerType>,), Output = BoxFn<Args, Return>> + Send + Sync,
{
- use crate::castable_factory::threadsafe::ThreadsafeCastableFactory;
+ use crate::private::castable_factory::threadsafe::ThreadsafeCastableFactory;
use crate::provider::r#async::AsyncFactoryVariant;
if self.di_container.has_binding::<Interface>(None).await {
@@ -288,7 +288,7 @@ where
> + Send
+ Sync,
{
- use crate::castable_factory::threadsafe::ThreadsafeCastableFactory;
+ use crate::private::castable_factory::threadsafe::ThreadsafeCastableFactory;
use crate::provider::r#async::AsyncFactoryVariant;
if self.di_container.has_binding::<Interface>(None).await {
@@ -378,7 +378,7 @@ where
> + Send
+ Sync,
{
- use crate::castable_factory::threadsafe::ThreadsafeCastableFactory;
+ use crate::private::castable_factory::threadsafe::ThreadsafeCastableFactory;
use crate::provider::r#async::AsyncFactoryVariant;
if self.di_container.has_binding::<Interface>(None).await {
@@ -472,7 +472,7 @@ where
> + Send
+ Sync,
{
- use crate::castable_factory::threadsafe::ThreadsafeCastableFactory;
+ use crate::private::castable_factory::threadsafe::ThreadsafeCastableFactory;
use crate::provider::r#async::AsyncFactoryVariant;
if self.di_container.has_binding::<Interface>(None).await {
diff --git a/src/di_container/asynchronous/mod.rs b/src/di_container/asynchronous/mod.rs
index 65f5c9e..ad1f44f 100644
--- a/src/di_container/asynchronous/mod.rs
+++ b/src/di_container/asynchronous/mod.rs
@@ -62,8 +62,9 @@ use crate::di_container::asynchronous::binding::builder::AsyncBindingBuilder;
use crate::di_container::binding_storage::DIContainerBindingStorage;
use crate::errors::async_di_container::AsyncDIContainerError;
use crate::future::BoxFuture;
-use crate::libs::intertrait::cast::error::CastError;
-use crate::libs::intertrait::cast::{CastArc, CastBox};
+use crate::private::cast::arc::CastArc;
+use crate::private::cast::boxed::CastBox;
+use crate::private::cast::error::CastError;
use crate::provider::r#async::{AsyncProvidable, IAsyncProvider};
use crate::ptr::{SomeThreadsafePtr, TransientPtr};
@@ -286,7 +287,7 @@ impl AsyncDIContainer
}
#[cfg(feature = "factory")]
AsyncProvidable::Factory(factory_binding) => {
- use crate::interfaces::factory::IThreadsafeFactory;
+ use crate::private::factory::IThreadsafeFactory;
let factory = factory_binding
.cast::<dyn IThreadsafeFactory<(Arc<AsyncDIContainer>,), Interface>>()
@@ -315,7 +316,7 @@ impl AsyncDIContainer
}
#[cfg(feature = "factory")]
AsyncProvidable::DefaultFactory(binding) => {
- use crate::interfaces::factory::IThreadsafeFactory;
+ use crate::private::factory::IThreadsafeFactory;
let default_factory = Self::cast_factory_binding::<
dyn IThreadsafeFactory<
@@ -328,7 +329,7 @@ impl AsyncDIContainer
}
#[cfg(feature = "factory")]
AsyncProvidable::AsyncDefaultFactory(binding) => {
- use crate::interfaces::factory::IThreadsafeFactory;
+ use crate::private::factory::IThreadsafeFactory;
let async_default_factory = Self::cast_factory_binding::<
dyn IThreadsafeFactory<
@@ -350,7 +351,7 @@ impl AsyncDIContainer
#[cfg(feature = "factory")]
fn cast_factory_binding<Type: 'static + ?Sized>(
- factory_binding: Arc<dyn crate::interfaces::any_factory::AnyThreadsafeFactory>,
+ factory_binding: Arc<dyn crate::private::any_factory::AnyThreadsafeFactory>,
binding_kind: &'static str,
) -> Result<Arc<Type>, AsyncDIContainerError>
{
@@ -667,7 +668,7 @@ mod tests
}
use crate as syrette;
- use crate::castable_factory::threadsafe::ThreadsafeCastableFactory;
+ use crate::private::castable_factory::threadsafe::ThreadsafeCastableFactory;
#[crate::factory(threadsafe = true)]
type IUserManagerFactory = dyn Fn(Vec<i128>) -> dyn IUserManager;
@@ -762,7 +763,7 @@ mod tests
}
use crate as syrette;
- use crate::castable_factory::threadsafe::ThreadsafeCastableFactory;
+ use crate::private::castable_factory::threadsafe::ThreadsafeCastableFactory;
#[crate::factory(threadsafe = true)]
type IUserManagerFactory = dyn Fn(Vec<i128>) -> dyn IUserManager;
diff --git a/src/di_container/blocking/binding/builder.rs b/src/di_container/blocking/binding/builder.rs
index 29422b6..65fa40f 100644
--- a/src/di_container/blocking/binding/builder.rs
+++ b/src/di_container/blocking/binding/builder.rs
@@ -203,7 +203,7 @@ where
Interface: Fn<Args, Output = crate::ptr::TransientPtr<Return>>,
Func: Fn<(std::rc::Rc<DIContainerType>,), Output = Box<Interface>>,
{
- use crate::castable_factory::blocking::CastableFactory;
+ use crate::private::castable_factory::blocking::CastableFactory;
if self.di_container.has_binding::<Interface>(None) {
return Err(BindingBuilderError::BindingAlreadyExists(type_name::<
@@ -295,7 +295,7 @@ where
>,
>,
{
- use crate::castable_factory::blocking::CastableFactory;
+ use crate::private::castable_factory::blocking::CastableFactory;
if self.di_container.has_binding::<Interface>(None) {
return Err(BindingBuilderError::BindingAlreadyExists(type_name::<
diff --git a/src/di_container/blocking/mod.rs b/src/di_container/blocking/mod.rs
index 97cca59..de7ef67 100644
--- a/src/di_container/blocking/mod.rs
+++ b/src/di_container/blocking/mod.rs
@@ -58,7 +58,8 @@ use crate::dependency_history::{DependencyHistory, IDependencyHistory};
use crate::di_container::binding_storage::DIContainerBindingStorage;
use crate::di_container::blocking::binding::builder::BindingBuilder;
use crate::errors::di_container::DIContainerError;
-use crate::libs::intertrait::cast::{CastBox, CastRc};
+use crate::private::cast::boxed::CastBox;
+use crate::private::cast::rc::CastRc;
use crate::provider::blocking::{IProvider, Providable};
use crate::ptr::SomePtr;
@@ -243,7 +244,7 @@ impl DIContainer
)),
#[cfg(feature = "factory")]
Providable::Factory(factory_binding) => {
- use crate::interfaces::factory::IFactory;
+ use crate::private::factory::IFactory;
let factory = factory_binding
.cast::<dyn IFactory<(Rc<DIContainer>,), Interface>>()
@@ -256,7 +257,7 @@ impl DIContainer
}
#[cfg(feature = "factory")]
Providable::DefaultFactory(factory_binding) => {
- use crate::interfaces::factory::IFactory;
+ use crate::private::factory::IFactory;
use crate::ptr::TransientPtr;
let default_factory = factory_binding
@@ -463,7 +464,7 @@ mod tests
#[cfg(feature = "factory")]
fn can_get_factory() -> Result<(), Box<dyn Error>>
{
- use crate::castable_factory::blocking::CastableFactory;
+ use crate::private::castable_factory::blocking::CastableFactory;
use crate::ptr::FactoryPtr;
trait IUserManager
@@ -547,7 +548,7 @@ mod tests
#[cfg(feature = "factory")]
fn can_get_factory_named() -> Result<(), Box<dyn Error>>
{
- use crate::castable_factory::blocking::CastableFactory;
+ use crate::private::castable_factory::blocking::CastableFactory;
use crate::ptr::FactoryPtr;
trait IUserManager