diff options
author | HampusM <hampus@hampusmat.com> | 2022-09-17 16:12:45 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-09-17 16:12:45 +0200 |
commit | 8651f84f205da7a89f2fc7333d1dd8de0d80a22b (patch) | |
tree | a178427abb442e897d21f654db71cc8135236920 /src/di_container_binding_map.rs | |
parent | c1e682c25c24be3174d44ceb95b0537c38299d0c (diff) |
refactor!: make async DI container be used inside of a Arc
BREAKING CHANGE: The async DI container is to be used inside of a Arc & it also no longer implements Default
Diffstat (limited to 'src/di_container_binding_map.rs')
-rw-r--r-- | src/di_container_binding_map.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/di_container_binding_map.rs b/src/di_container_binding_map.rs index 4aa246e..eb71ff7 100644 --- a/src/di_container_binding_map.rs +++ b/src/di_container_binding_map.rs @@ -27,18 +27,17 @@ where } } - pub fn get<Interface>(&self, name: Option<&'static str>) -> Option<&Provider> + #[allow(clippy::borrowed_box)] + pub fn get<Interface>(&self, name: Option<&'static str>) -> Option<&Box<Provider>> where Interface: 'static + ?Sized, { let interface_typeid = TypeId::of::<Interface>(); - self.bindings - .get(&DIContainerBindingKey { - type_id: interface_typeid, - name, - }) - .map(|provider| provider.as_ref()) + self.bindings.get(&DIContainerBindingKey { + type_id: interface_typeid, + name, + }) } pub fn set<Interface>(&mut self, name: Option<&'static str>, provider: Box<Provider>) |