use where clause for long lines
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
4432c06c86
commit
eb6e509ad8
2 changed files with 20 additions and 5 deletions
|
@ -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<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)
|
||||
.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<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()
|
||||
.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<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()
|
||||
.expect("locked for reading")
|
||||
.get(name)
|
||||
|
|
|
@ -193,11 +193,17 @@ impl Services {
|
|||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue