pub trait Service {
type Input;
type Output;
type Error;
// Required method
fn process(&self, input: Self::Input) -> Result<Self::Output, Self::Error>;
// Provided methods
fn into_mut(self) -> ServiceMut<Self>
where Self: Sized { ... }
fn into_async(self) -> ServiceAsync<Self>
where Self: Sized + Send + Sync + 'static { ... }
fn into_dyn<'a>(
self
) -> DynService<'a, Self::Input, Self::Output, Self::Error>
where Self: Sized + 'static { ... }
}
Expand description
A sync service trait
Accepts &self
and an input, producing a Result<Self::Output, Self::Error>
.
Conversion to MutService
or AsyncService
:
- The
into_mut
function can be used to convert aService
into aServiceMut
- The
into_async
function can be used to convert aService
to aServiceAsync
whenService::Input
,Service::Output
, andService::Error
areSend
and whenService
isSend
+Sync
Required Associated Types§
Required Methods§
Provided Methods§
sourcefn into_mut(self) -> ServiceMut<Self>where
Self: Sized,
fn into_mut(self) -> ServiceMut<Self>where
Self: Sized,
Convert this Service
into a ServiceMut
which impls MutService
sourcefn into_async(self) -> ServiceAsync<Self>
fn into_async(self) -> ServiceAsync<Self>
Convert this Service
into a ServiceAsync
which impls AsyncService
sourcefn into_dyn<'a>(self) -> DynService<'a, Self::Input, Self::Output, Self::Error>where
Self: Sized + 'static,
fn into_dyn<'a>(self) -> DynService<'a, Self::Input, Self::Output, Self::Error>where
Self: Sized + 'static,
Convert this Service
into a DynService