diff options
Diffstat (limited to 'src/di_container')
-rw-r--r-- | src/di_container/blocking/mod.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/di_container/blocking/mod.rs b/src/di_container/blocking/mod.rs index 1ee0294..702141a 100644 --- a/src/di_container/blocking/mod.rs +++ b/src/di_container/blocking/mod.rs @@ -209,7 +209,7 @@ impl DIContainer use crate::private::factory::IFactory; let factory = factory_binding - .cast::<dyn IFactory<(Rc<DIContainer>,), Interface>>() + .cast::<dyn IFactory<Interface, Self>>() .map_err(|_| DIContainerError::CastFailed { interface: type_name::<Interface>(), binding_kind: "factory", @@ -222,11 +222,13 @@ impl DIContainer use crate::private::factory::IFactory; use crate::ptr::TransientPtr; + type DefaultFactoryFn<Interface> = dyn IFactory< + dyn Fn<(), Output = TransientPtr<Interface>>, + DIContainer, + >; + let default_factory = factory_binding - .cast::<dyn IFactory< - (Rc<DIContainer>,), - dyn Fn<(), Output = TransientPtr<Interface>>, - >>() + .cast::<DefaultFactoryFn<Interface>>() .map_err(|_| DIContainerError::CastFailed { interface: type_name::<Interface>(), binding_kind: "default factory", |