simplify service trait bounds and lifetimes

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-08-30 00:26:23 +00:00 committed by strawberry
parent 16014e1594
commit 2db017af37
2 changed files with 13 additions and 18 deletions

View file

@ -193,16 +193,16 @@ impl Services {
}
}
pub fn try_get<'a, 'b, T>(&'b self, name: &'a str) -> Result<Arc<T>>
pub fn try_get<T>(&self, name: &str) -> Result<Arc<T>>
where
T: Send + Sync + 'a + 'b + 'static,
T: Any + Send + Sync + Sized,
{
service::try_get::<T>(&self.service, name)
}
pub fn get<'a, 'b, T>(&'b self, name: &'a str) -> Option<Arc<T>>
pub fn get<T>(&self, name: &str) -> Option<Arc<T>>
where
T: Send + Sync + 'a + 'b + 'static,
T: Any + Send + Sync + Sized,
{
service::get::<T>(&self.service, name)
}