aboutsummaryrefslogtreecommitdiff
path: root/src/di_container_binding_map.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/di_container_binding_map.rs')
-rw-r--r--src/di_container_binding_map.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/di_container_binding_map.rs b/src/di_container_binding_map.rs
index e64ff17..20d040f 100644
--- a/src/di_container_binding_map.rs
+++ b/src/di_container_binding_map.rs
@@ -31,19 +31,22 @@ impl DIContainerBindingMap
.as_ref())
}
- pub fn set<Interface>(&mut self, provider: Box<dyn IProvider>) -> Option<()>
+ pub fn set<Interface>(&mut self, provider: Box<dyn IProvider>)
where
Interface: 'static + ?Sized,
{
let interface_typeid = TypeId::of::<Interface>();
- if self.bindings.contains_key(&interface_typeid) {
- return None;
- }
-
self.bindings.insert(interface_typeid, provider);
+ }
+
+ pub fn has<Interface>(&self) -> bool
+ where
+ Interface: 'static + ?Sized,
+ {
+ let interface_typeid = TypeId::of::<Interface>();
- Some(())
+ self.bindings.contains_key(&interface_typeid)
}
/// Only used by tests in the `di_container` module.