From 8651f84f205da7a89f2fc7333d1dd8de0d80a22b Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 17 Sep 2022 16:12:45 +0200 Subject: 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 --- src/di_container_binding_map.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/di_container_binding_map.rs') 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(&self, name: Option<&'static str>) -> Option<&Provider> + #[allow(clippy::borrowed_box)] + pub fn get(&self, name: Option<&'static str>) -> Option<&Box> where Interface: 'static + ?Sized, { let interface_typeid = TypeId::of::(); - 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(&mut self, name: Option<&'static str>, provider: Box) -- cgit v1.2.3-18-g5258