From e381ae3b8649de47ba46925e402946658ac16d20 Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 15 Aug 2023 23:15:19 +0200 Subject: 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 --- src/di_container/blocking/binding/builder.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/di_container/blocking/binding') diff --git a/src/di_container/blocking/binding/builder.rs b/src/di_container/blocking/binding/builder.rs index 991961c..91855f5 100644 --- a/src/di_container/blocking/binding/builder.rs +++ b/src/di_container/blocking/binding/builder.rs @@ -151,10 +151,10 @@ where /// # impl ICustomer for Customer {} /// # /// # #[factory] - /// # type ICustomerFactory = dyn Fn(String, u32) -> dyn ICustomer; + /// # type ICustomerFactory = dyn Fn(String, u32) -> TransientPtr; /// # /// # #[factory] - /// # type ICustomerIDFactory = dyn Fn(u32) -> dyn ICustomerID; + /// # type ICustomerIDFactory = dyn Fn(u32) -> TransientPtr; /// # /// # fn main() -> Result<(), Box> /// # { @@ -354,7 +354,8 @@ mod tests use crate::ptr::TransientPtr; #[factory] - type IUserManagerFactory = dyn Fn(i32, String) -> dyn subjects::IUserManager; + type IUserManagerFactory = + dyn Fn(i32, String) -> TransientPtr; let mut mock_di_container = mocks::blocking_di_container::MockDIContainer::new(); -- cgit v1.2.3-18-g5258