aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/interfaces/async_injectable.rs4
-rw-r--r--src/private/any_factory.rs4
-rw-r--r--src/private/cast/arc.rs4
-rw-r--r--src/private/cast/mod.rs10
-rw-r--r--src/private/factory.rs2
-rw-r--r--src/test_utils.rs4
6 files changed, 14 insertions, 14 deletions
diff --git a/src/interfaces/async_injectable.rs b/src/interfaces/async_injectable.rs
index e6a050e..d8e7dfc 100644
--- a/src/interfaces/async_injectable.rs
+++ b/src/interfaces/async_injectable.rs
@@ -6,11 +6,11 @@ use crate::dependency_history::IDependencyHistory;
use crate::di_container::asynchronous::IAsyncDIContainer;
use crate::errors::injectable::InjectableError;
use crate::future::BoxFuture;
-use crate::private::cast::CastFromSync;
+use crate::private::cast::CastFromArc;
use crate::ptr::TransientPtr;
/// Interface for structs that can be injected into or be injected to.
-pub trait AsyncInjectable<DIContainerType, DependencyHistoryType>: CastFromSync
+pub trait AsyncInjectable<DIContainerType, DependencyHistoryType>: CastFromArc
where
DIContainerType: IAsyncDIContainer<DependencyHistoryType>,
DependencyHistoryType: IDependencyHistory + Send + Sync,
diff --git a/src/private/any_factory.rs b/src/private/any_factory.rs
index bdd68a6..64af57e 100644
--- a/src/private/any_factory.rs
+++ b/src/private/any_factory.rs
@@ -2,10 +2,10 @@
use std::fmt::Debug;
-use crate::private::cast::{CastFrom, CastFromSync};
+use crate::private::cast::{CastFrom, CastFromArc};
/// Interface for any factory to ever exist.
pub trait AnyFactory: CastFrom + Debug {}
/// Interface for any threadsafe factory to ever exist.
-pub trait AnyThreadsafeFactory: CastFromSync + Debug {}
+pub trait AnyThreadsafeFactory: CastFromArc + Debug {}
diff --git a/src/private/cast/arc.rs b/src/private/cast/arc.rs
index 7ea8b49..1fbdf8b 100644
--- a/src/private/cast/arc.rs
+++ b/src/private/cast/arc.rs
@@ -13,7 +13,7 @@ use std::any::type_name;
use std::sync::Arc;
use crate::private::cast::error::CastError;
-use crate::private::cast::{get_caster, CastFromSync};
+use crate::private::cast::{get_caster, CastFromArc};
pub trait CastArc
{
@@ -23,7 +23,7 @@ pub trait CastArc
/// A blanket implementation of `CastArc` for traits extending `CastFrom`, `Sync`, and
/// `Send`.
-impl<CastFromSelf: ?Sized + CastFromSync> CastArc for CastFromSelf
+impl<CastFromSelf: ?Sized + CastFromArc> CastArc for CastFromSelf
{
fn cast<Dest: ?Sized + 'static>(self: Arc<Self>) -> Result<Arc<Dest>, CastError>
{
diff --git a/src/private/cast/mod.rs b/src/private/cast/mod.rs
index 0b80057..ddff2a4 100644
--- a/src/private/cast/mod.rs
+++ b/src/private/cast/mod.rs
@@ -153,7 +153,7 @@ pub trait CastFrom: Any + 'static
fn rc_any(self: Rc<Self>) -> Rc<dyn Any>;
}
-/// `CastFromSync` must be extended by a trait that is `Any + Sync + Send + 'static`
+/// This trait must be extended by a trait that is `Any + Sync + Send + 'static`
/// and wants to allow for casting into another trait behind references and smart pointers
/// especially including `Arc`.
///
@@ -163,11 +163,11 @@ pub trait CastFrom: Any + 'static
///
/// # Examples
/// ```ignore
-/// trait Source: CastFromSync {
+/// trait Source: CastFromArc {
/// ...
/// }
/// ```
-pub trait CastFromSync: CastFrom + Sync + Send + 'static
+pub trait CastFromArc: CastFrom + Sync + Send + 'static
{
fn arc_any(self: Arc<Self>) -> Arc<dyn Any + Sync + Send + 'static>;
}
@@ -198,7 +198,7 @@ impl CastFrom for dyn Any + 'static
}
}
-impl<Source: Sized + Sync + Send + 'static> CastFromSync for Source
+impl<Source: Sized + Sync + Send + 'static> CastFromArc for Source
{
fn arc_any(self: Arc<Self>) -> Arc<dyn Any + Sync + Send + 'static>
{
@@ -219,7 +219,7 @@ impl CastFrom for dyn Any + Sync + Send + 'static
}
}
-impl CastFromSync for dyn Any + Sync + Send + 'static
+impl CastFromArc for dyn Any + Sync + Send + 'static
{
fn arc_any(self: Arc<Self>) -> Arc<dyn Any + Sync + Send + 'static>
{
diff --git a/src/private/factory.rs b/src/private/factory.rs
index 8b8354d..84b00c6 100644
--- a/src/private/factory.rs
+++ b/src/private/factory.rs
@@ -15,7 +15,7 @@ where
/// Interface for a threadsafe factory.
#[cfg(feature = "async")]
pub trait IThreadsafeFactory<Args, ReturnInterface>:
- Fn<Args, Output = TransientPtr<ReturnInterface>> + crate::private::cast::CastFromSync
+ Fn<Args, Output = TransientPtr<ReturnInterface>> + crate::private::cast::CastFromArc
where
Args: Tuple,
ReturnInterface: 'static + ?Sized,
diff --git a/src/test_utils.rs b/src/test_utils.rs
index 8f07fa9..97fe620 100644
--- a/src/test_utils.rs
+++ b/src/test_utils.rs
@@ -10,7 +10,7 @@ pub mod subjects
use crate::dependency_history::IDependencyHistory;
use crate::di_container::blocking::IDIContainer;
use crate::interfaces::injectable::Injectable;
- use crate::private::cast::CastFromSync;
+ use crate::private::cast::CastFromArc;
use crate::ptr::TransientPtr;
pub trait IUserManager
@@ -135,7 +135,7 @@ pub mod subjects
#[derive(Debug)]
pub struct Ninja;
- pub trait INinja: CastFromSync {}
+ pub trait INinja: CastFromArc {}
impl INinja for Ninja {}
}