diff --git a/src/service/service.rs b/src/service/service.rs index 0b9bc76c..635f782e 100644 --- a/src/service/service.rs +++ b/src/service/service.rs @@ -97,7 +97,10 @@ impl<'a> Args<'a> { /// Reference a Service by name. Panics if the Service does not exist or was /// incorrectly cast. -pub(crate) fn require<'a, 'b, T: Send + Sync + 'a + 'b + 'static>(map: &'b Map, name: &'a str) -> Arc { +pub(crate) fn require<'a, 'b, T>(map: &'b Map, name: &'a str) -> Arc +where + T: Send + Sync + 'a + 'b + 'static, +{ try_get::(map, name) .inspect_err(inspect_log) .expect("Failure to reference service required by another service.") @@ -109,7 +112,10 @@ pub(crate) fn require<'a, 'b, T: Send + Sync + 'a + 'b + 'static>(map: &'b Map, /// # Panics /// Incorrect type is not a silent failure (None) as the type never has a reason /// to be incorrect. -pub(crate) fn get<'a, 'b, T: Send + Sync + 'a + 'b + 'static>(map: &'b Map, name: &'a str) -> Option> { +pub(crate) fn get<'a, 'b, T>(map: &'b Map, name: &'a str) -> Option> +where + T: Send + Sync + 'a + 'b + 'static, +{ map.read() .expect("locked for reading") .get(name) @@ -123,7 +129,10 @@ pub(crate) fn get<'a, 'b, T: Send + Sync + 'a + 'b + 'static>(map: &'b Map, name /// Reference a Service by name. Returns Err if the Service does not exist or /// was incorrectly cast. -pub(crate) fn try_get<'a, 'b, T: Send + Sync + 'a + 'b + 'static>(map: &'b Map, name: &'a str) -> Result> { +pub(crate) fn try_get<'a, 'b, T>(map: &'b Map, name: &'a str) -> Result> +where + T: Send + Sync + 'a + 'b + 'static, +{ map.read() .expect("locked for reading") .get(name) diff --git a/src/service/services.rs b/src/service/services.rs index 2b9b93d4..8e69cdbb 100644 --- a/src/service/services.rs +++ b/src/service/services.rs @@ -193,11 +193,17 @@ impl Services { } } - pub fn try_get<'a, 'b, T: Send + Sync + 'a + 'b + 'static>(&'b self, name: &'a str) -> Result> { + pub fn try_get<'a, 'b, T>(&'b self, name: &'a str) -> Result> + where + T: Send + Sync + 'a + 'b + 'static, + { service::try_get::(&self.service, name) } - pub fn get<'a, 'b, T: Send + Sync + 'a + 'b + 'static>(&'b self, name: &'a str) -> Option> { + pub fn get<'a, 'b, T>(&'b self, name: &'a str) -> Option> + where + T: Send + Sync + 'a + 'b + 'static, + { service::get::(&self.service, name) } }