aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-10-01 22:10:18 +0200
committerHampusM <hampus@hampusmat.com>2022-10-01 22:10:18 +0200
commitc614b0f70b672265c3a2a790bb8fc92e09f6fd00 (patch)
tree3c8b0eb5509b07d3210bb70bd2cbd6215ec9516c /src/interfaces
parent344dff10f8ac2e176239e10190bdb627bf58156b (diff)
refactor: stop using the async_trait macro for AsyncInjectable
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/async_injectable.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/interfaces/async_injectable.rs b/src/interfaces/async_injectable.rs
index fb5452b..07a21aa 100644
--- a/src/interfaces/async_injectable.rs
+++ b/src/interfaces/async_injectable.rs
@@ -4,27 +4,26 @@
use std::fmt::Debug;
use std::sync::Arc;
-use async_trait::async_trait;
-
use crate::async_di_container::AsyncDIContainer;
use crate::errors::injectable::InjectableError;
+use crate::future::BoxFuture;
use crate::libs::intertrait::CastFromSync;
use crate::ptr::TransientPtr;
/// Interface for structs that can be injected into or be injected to.
-#[async_trait]
pub trait AsyncInjectable: CastFromSync
{
/// Resolves the dependencies of the injectable.
///
/// # Errors
/// Will return `Err` if resolving the dependencies fails.
- async fn resolve(
- di_container: &Arc<AsyncDIContainer>,
+ fn resolve<'di_container, 'fut>(
+ di_container: &'di_container Arc<AsyncDIContainer>,
dependency_history: Vec<&'static str>,
- ) -> Result<TransientPtr<Self>, InjectableError>
+ ) -> BoxFuture<'fut, Result<TransientPtr<Self>, InjectableError>>
where
- Self: Sized;
+ Self: Sized + 'fut,
+ 'di_container: 'fut;
}
impl Debug for dyn AsyncInjectable