diff options
author | HampusM <hampus@hampusmat.com> | 2023-08-15 23:15:19 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-08-15 23:18:59 +0200 |
commit | e381ae3b8649de47ba46925e402946658ac16d20 (patch) | |
tree | 32ecc7e4592f25d43dc1e76399d3fffae3272e1e /src/di_container/asynchronous/mod.rs | |
parent | 9423d67efb161d9a94a7ab6c5899c6bc7ecaee7c (diff) |
fix!: make the factory macro not change its input
BREAKING CHANGE: The factory macro no longer
- Changes the return type to be inside of a TransientPtr
- Adds Send + Sync bounds when the threadsafe or the async flag is set
- Changes the return type be inside of a BoxFuture when the async flag is set
Diffstat (limited to 'src/di_container/asynchronous/mod.rs')
-rw-r--r-- | src/di_container/asynchronous/mod.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/di_container/asynchronous/mod.rs b/src/di_container/asynchronous/mod.rs index 927f549..d330f4a 100644 --- a/src/di_container/asynchronous/mod.rs +++ b/src/di_container/asynchronous/mod.rs @@ -657,7 +657,8 @@ mod tests use crate::private::castable_factory::threadsafe::ThreadsafeCastableFactory; #[crate::factory(threadsafe = true)] - type IUserManagerFactory = dyn Fn(Vec<i128>) -> dyn IUserManager; + type IUserManagerFactory = + dyn Fn(Vec<i128>) -> TransientPtr<dyn IUserManager> + Send + Sync; let di_container = AsyncDIContainer::new(); @@ -752,7 +753,8 @@ mod tests use crate::private::castable_factory::threadsafe::ThreadsafeCastableFactory; #[crate::factory(threadsafe = true)] - type IUserManagerFactory = dyn Fn(Vec<i128>) -> dyn IUserManager; + type IUserManagerFactory = + dyn Fn(Vec<i128>) -> TransientPtr<dyn IUserManager> + Send + Sync; let di_container = AsyncDIContainer::new(); |