From 0b4232d343e2214ead8fa62583bff2e948173ddf Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 20 Aug 2023 17:01:12 +0200 Subject: feat: expose DI container get_bound methods to public API --- src/di_container/binding_storage.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/di_container/binding_storage.rs') diff --git a/src/di_container/binding_storage.rs b/src/di_container/binding_storage.rs index 2bc208f..3c3c565 100644 --- a/src/di_container/binding_storage.rs +++ b/src/di_container/binding_storage.rs @@ -6,7 +6,7 @@ pub struct DIContainerBindingStorage where Provider: 'static + ?Sized, { - inner: AHashMap>, + inner: AHashMap, Box>, } impl DIContainerBindingStorage @@ -21,7 +21,10 @@ where } #[allow(clippy::borrowed_box)] - pub fn get(&self, name: Option<&'static str>) -> Option<&Box> + pub fn get<'me, Interface>( + &'me self, + name: Option<&'me str>, + ) -> Option<&'me Box> where Interface: 'static + ?Sized, { @@ -77,10 +80,10 @@ where } #[derive(Debug, PartialEq, Eq, Hash)] -struct BindingIdentification +struct BindingIdentification<'a> { type_id: TypeId, - name: Option<&'static str>, + name: Option<&'a str>, } #[cfg(test)] -- cgit v1.2.3-18-g5258