aboutsummaryrefslogtreecommitdiff
path: root/src/di_container.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/di_container.rs')
-rw-r--r--src/di_container.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/di_container.rs b/src/di_container.rs
index b0e5af1..df95be4 100644
--- a/src/di_container.rs
+++ b/src/di_container.rs
@@ -384,12 +384,18 @@ impl DIContainer
match binding_providable {
Providable::Transient(transient_binding) => Ok(SomePtr::Transient(
transient_binding.cast::<Interface>().map_err(|_| {
- DIContainerError::CastFailed(type_name::<Interface>())
+ DIContainerError::CastFailed {
+ interface: type_name::<Interface>(),
+ binding_kind: "transient",
+ }
})?,
)),
Providable::Singleton(singleton_binding) => Ok(SomePtr::Singleton(
singleton_binding.cast::<Interface>().map_err(|_| {
- DIContainerError::CastFailed(type_name::<Interface>())
+ DIContainerError::CastFailed {
+ interface: type_name::<Interface>(),
+ binding_kind: "singleton",
+ }
})?,
)),
#[cfg(feature = "factory")]
@@ -401,8 +407,9 @@ impl DIContainer
let default_factory = factory_binding
.cast::<dyn IFactory<(), Interface>>()
- .map_err(|_| {
- DIContainerError::CastFailed(type_name::<Interface>())
+ .map_err(|_| DIContainerError::CastFailed {
+ interface: type_name::<Interface>(),
+ binding_kind: "factory",
})?;
Ok(SomePtr::Transient(default_factory()))