From 75ca777bbeb618e14b1cf8854ebb37b7a2c884b5 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 16 Sep 2023 16:04:47 +0200 Subject: refactor: make castable factory take DI container param --- src/di_container/blocking/mod.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/di_container/blocking') 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::,), Interface>>() + .cast::>() .map_err(|_| DIContainerError::CastFailed { interface: type_name::(), binding_kind: "factory", @@ -222,11 +222,13 @@ impl DIContainer use crate::private::factory::IFactory; use crate::ptr::TransientPtr; + type DefaultFactoryFn = dyn IFactory< + dyn Fn<(), Output = TransientPtr>, + DIContainer, + >; + let default_factory = factory_binding - .cast::,), - dyn Fn<(), Output = TransientPtr>, - >>() + .cast::>() .map_err(|_| DIContainerError::CastFailed { interface: type_name::(), binding_kind: "default factory", -- cgit v1.2.3-18-g5258