Skip to content
Snippets Groups Projects
Commit eb6e509a authored by Jason Volk's avatar Jason Volk
Browse files

use where clause for long lines


Signed-off-by: default avatarJason Volk <jason@zemos.net>
parent 4432c06c
No related branches found
No related tags found
3 merge requests!561morguldir/sliding sync fixes,!559Auth Media,!553Misc
...@@ -97,7 +97,10 @@ pub(crate) fn require<T: Send + Sync + 'a + 'static>(&'a self, name: &'static st ...@@ -97,7 +97,10 @@ pub(crate) fn require<T: Send + Sync + 'a + 'static>(&'a self, name: &'static st
/// Reference a Service by name. Panics if the Service does not exist or was /// Reference a Service by name. Panics if the Service does not exist or was
/// incorrectly cast. /// incorrectly cast.
pub(crate) fn require<'a, 'b, T: Send + Sync + 'a + 'b + 'static>(map: &'b Map, name: &'a str) -> Arc<T> { pub(crate) fn require<'a, 'b, T>(map: &'b Map, name: &'a str) -> Arc<T>
where
T: Send + Sync + 'a + 'b + 'static,
{
try_get::<T>(map, name) try_get::<T>(map, name)
.inspect_err(inspect_log) .inspect_err(inspect_log)
.expect("Failure to reference service required by another service.") .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, ...@@ -109,7 +112,10 @@ pub(crate) fn require<'a, 'b, T: Send + Sync + 'a + 'b + 'static>(map: &'b Map,
/// # Panics /// # Panics
/// Incorrect type is not a silent failure (None) as the type never has a reason /// Incorrect type is not a silent failure (None) as the type never has a reason
/// to be incorrect. /// to be incorrect.
pub(crate) fn get<'a, 'b, T: Send + Sync + 'a + 'b + 'static>(map: &'b Map, name: &'a str) -> Option<Arc<T>> { pub(crate) fn get<'a, 'b, T>(map: &'b Map, name: &'a str) -> Option<Arc<T>>
where
T: Send + Sync + 'a + 'b + 'static,
{
map.read() map.read()
.expect("locked for reading") .expect("locked for reading")
.get(name) .get(name)
...@@ -123,7 +129,10 @@ pub(crate) fn get<'a, 'b, T: Send + Sync + 'a + 'b + 'static>(map: &'b Map, 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 /// Reference a Service by name. Returns Err if the Service does not exist or
/// was incorrectly cast. /// was incorrectly cast.
pub(crate) fn try_get<'a, 'b, T: Send + Sync + 'a + 'b + 'static>(map: &'b Map, name: &'a str) -> Result<Arc<T>> { pub(crate) fn try_get<'a, 'b, T>(map: &'b Map, name: &'a str) -> Result<Arc<T>>
where
T: Send + Sync + 'a + 'b + 'static,
{
map.read() map.read()
.expect("locked for reading") .expect("locked for reading")
.get(name) .get(name)
......
...@@ -193,11 +193,17 @@ fn interrupt(&self) { ...@@ -193,11 +193,17 @@ fn interrupt(&self) {
} }
} }
pub fn try_get<'a, 'b, T: Send + Sync + 'a + 'b + 'static>(&'b self, name: &'a str) -> Result<Arc<T>> { pub fn try_get<'a, 'b, T>(&'b self, name: &'a str) -> Result<Arc<T>>
where
T: Send + Sync + 'a + 'b + 'static,
{
service::try_get::<T>(&self.service, name) service::try_get::<T>(&self.service, name)
} }
pub fn get<'a, 'b, T: Send + Sync + 'a + 'b + 'static>(&'b self, name: &'a str) -> Option<Arc<T>> { pub fn get<'a, 'b, T>(&'b self, name: &'a str) -> Option<Arc<T>>
where
T: Send + Sync + 'a + 'b + 'static,
{
service::get::<T>(&self.service, name) service::get::<T>(&self.service, name)
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment