aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/di_container/blocking/mod.rs61
1 files changed, 32 insertions, 29 deletions
diff --git a/src/di_container/blocking/mod.rs b/src/di_container/blocking/mod.rs
index 548f716..1ee0294 100644
--- a/src/di_container/blocking/mod.rs
+++ b/src/di_container/blocking/mod.rs
@@ -237,35 +237,6 @@ impl DIContainer
}
}
- fn get_binding_providable<Interface>(
- self: &Rc<Self>,
- binding_options: BindingOptionsWithLt,
- dependency_history: DependencyHistory,
- ) -> Result<Providable<Self>, DIContainerError>
- where
- Interface: 'static + ?Sized,
- {
- let name = binding_options.name;
-
- self.binding_storage
- .borrow()
- .get::<Interface>(binding_options)
- .map_or_else(
- || {
- Err(DIContainerError::BindingNotFound {
- interface: type_name::<Interface>(),
- name: name.as_ref().map(ToString::to_string),
- })
- },
- Ok,
- )?
- .provide(self, dependency_history)
- .map_err(|err| DIContainerError::BindingResolveFailed {
- reason: err,
- interface: type_name::<Interface>(),
- })
- }
-
fn has_binding<Interface>(
self: &Rc<Self>,
binding_options: BindingOptionsWithLt,
@@ -303,6 +274,38 @@ impl DIContainer
}
}
+impl DIContainer
+{
+ fn get_binding_providable<Interface>(
+ self: &Rc<Self>,
+ binding_options: BindingOptionsWithLt,
+ dependency_history: DependencyHistory,
+ ) -> Result<Providable<Self>, DIContainerError>
+ where
+ Interface: 'static + ?Sized,
+ {
+ let name = binding_options.name;
+
+ self.binding_storage
+ .borrow()
+ .get::<Interface>(binding_options)
+ .map_or_else(
+ || {
+ Err(DIContainerError::BindingNotFound {
+ interface: type_name::<Interface>(),
+ name: name.as_ref().map(ToString::to_string),
+ })
+ },
+ Ok,
+ )?
+ .provide(self, dependency_history)
+ .map_err(|err| DIContainerError::BindingResolveFailed {
+ reason: err,
+ interface: type_name::<Interface>(),
+ })
+ }
+}
+
#[cfg(test)]
mod tests
{