diff options
author | HampusM <hampus@hampusmat.com> | 2023-12-25 22:53:13 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-12-28 12:00:11 +0100 |
commit | 607d8d50b76665b67ca6f3124aa81773bec110b7 (patch) | |
tree | 142a7c17c4e254eabd5a5396975921bca1869bec /src/interfaces/async_injectable.rs | |
parent | c501a5cc770f632eba1529de09bd3ae2d7958de6 (diff) |
WIP Linkme dependency removalwithout-linkme
Diffstat (limited to 'src/interfaces/async_injectable.rs')
-rw-r--r-- | src/interfaces/async_injectable.rs | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/interfaces/async_injectable.rs b/src/interfaces/async_injectable.rs index 3600bac..cf903e7 100644 --- a/src/interfaces/async_injectable.rs +++ b/src/interfaces/async_injectable.rs @@ -1,17 +1,19 @@ //! Interface for structs that can be injected into or be injected to. use std::fmt::Debug; use std::future::ready; +use std::rc::Rc; +use std::sync::Arc; use crate::errors::injectable::InjectableError; use crate::future::BoxFuture; -use crate::private::cast::CastFromArc; use crate::ptr::TransientPtr; +use crate::ptr_buffer::PtrBuffer; use crate::util::use_double; use_double!(crate::dependency_history::DependencyHistory); /// Interface for structs that can be injected into or be injected to. -pub trait AsyncInjectable<DIContainerT>: CastFromArc +pub trait AsyncInjectable<DIContainerT>: 'static + Send + Sync { /// Resolves the dependencies of the injectable. /// @@ -24,6 +26,15 @@ pub trait AsyncInjectable<DIContainerT>: CastFromArc where Self: Sized + 'fut, 'di_container: 'fut; + + /// A. + fn into_ptr_buffer_box(self: Box<Self>) -> PtrBuffer; + + /// A. + fn into_ptr_buffer_rc(self: Rc<Self>) -> PtrBuffer; + + /// A. + fn into_ptr_buffer_arc(self: Arc<Self>) -> PtrBuffer; } impl<DIContainerT> Debug for dyn AsyncInjectable<DIContainerT> @@ -48,4 +59,19 @@ where { Box::pin(ready(Ok(TransientPtr::new(Self::default())))) } + + fn into_ptr_buffer_box(self: Box<Self>) -> PtrBuffer + { + PtrBuffer::new_from(self) + } + + fn into_ptr_buffer_rc(self: Rc<Self>) -> PtrBuffer + { + PtrBuffer::new_from(self) + } + + fn into_ptr_buffer_arc(self: Arc<Self>) -> PtrBuffer + { + PtrBuffer::new_from(self) + } } |