aboutsummaryrefslogtreecommitdiff
path: root/src/di_container/binding_storage.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-08-20 17:01:12 +0200
committerHampusM <hampus@hampusmat.com>2023-08-20 17:01:12 +0200
commit0b4232d343e2214ead8fa62583bff2e948173ddf (patch)
treef809051c9933a132971ab91244e83d1f9d387ad6 /src/di_container/binding_storage.rs
parentbe2c39b452b8b1e024300caff1ce8f11d54b27ce (diff)
feat: expose DI container get_bound methods to public API
Diffstat (limited to 'src/di_container/binding_storage.rs')
-rw-r--r--src/di_container/binding_storage.rs11
1 files changed, 7 insertions, 4 deletions
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<Provider>
where
Provider: 'static + ?Sized,
{
- inner: AHashMap<BindingIdentification, Box<Provider>>,
+ inner: AHashMap<BindingIdentification<'static>, Box<Provider>>,
}
impl<Provider> DIContainerBindingStorage<Provider>
@@ -21,7 +21,10 @@ where
}
#[allow(clippy::borrowed_box)]
- pub fn get<Interface>(&self, name: Option<&'static str>) -> Option<&Box<Provider>>
+ pub fn get<'me, Interface>(
+ &'me self,
+ name: Option<&'me str>,
+ ) -> Option<&'me Box<Provider>>
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)]