Trait sod::Service

source ·
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:

Required Associated Types§

Required Methods§

source

fn process(&self, input: Self::Input) -> Result<Self::Output, Self::Error>

Process an input, producing a Result<Self::Output, Self::Error>

Provided Methods§

source

fn into_mut(self) -> ServiceMut<Self>where Self: Sized,

Convert this Service into a ServiceMut which impls MutService

source

fn into_async(self) -> ServiceAsync<Self>where Self: Sized + Send + Sync + 'static,

Convert this Service into a ServiceAsync which impls AsyncService

source

fn into_dyn<'a>(self) -> DynService<'a, Self::Input, Self::Output, Self::Error>where Self: Sized + 'static,

Convert this Service into a DynService

Implementors§

source§

impl<'a, I, O, E> Service for DynService<'a, I, O, E>

§

type Input = I

§

type Output = O

§

type Error = E

source§

impl<'a, I: 'a, E, S1: Service<Input = &'a I, Error = E>, S2: Service<Input = &'a I, Error = E>> Service for RefForkService<I, S1, S2>

§

type Input = &'a I

§

type Output = (<S1 as Service>::Output, <S2 as Service>::Output)

§

type Error = E

source§

impl<'a, T> Service for NoOpService<'a, T>

§

type Input = T

§

type Output = T

§

type Error = Infallible

source§

impl<I, KeepRunningFunc: Fn() -> bool> Service for StopService<I, KeepRunningFunc>

§

type Input = I

§

type Output = I

§

type Error = Stopped

source§

impl<I, O, E, F: Fn(I) -> Result<O, E>> Service for FnService<I, O, E, F>

§

type Input = I

§

type Output = O

§

type Error = E

source§

impl<O, E, I: TryInto<O, Error = E>> Service for TryIntoService<O, I>

§

type Input = I

§

type Output = O

§

type Error = E

source§

impl<O, E, S, F> Service for PollService<E, S, F>where S: Service<Input = (), Output = Option<O>, Error = E>, F: Fn(usize) -> Result<(), RetryError<E>>,

§

type Input = ()

§

type Output = O

§

type Error = RetryError<<S as Service>::Error>

source§

impl<O, I: Into<O>> Service for IntoService<O, I>

§

type Input = I

§

type Output = O

§

type Error = Infallible

source§

impl<P: Service, S: Service<Input = P::Output>> Service for ServiceChain<P, S>where P::Error: Debug + 'static, S::Error: Debug + 'static,

§

type Input = <P as Service>::Input

§

type Output = <S as Service>::Output

§

type Error = ServiceChainError<Box<dyn Debug>>

source§

impl<S1: Service, S2: Service<Input = S1::Input, Error = S1::Error>> Service for CloningForkService<S1, S2>where S1::Input: Clone,

§

type Input = <S1 as Service>::Input

§

type Output = (<S1 as Service>::Output, <S2 as Service>::Output)

§

type Error = <S1 as Service>::Error

source§

impl<S> Service for RetryToOptionService<S>where S: Service + Retryable<S::Input, S::Error>,

§

type Input = <S as Service>::Input

§

type Output = Option<<S as Service>::Output>

§

type Error = RetryError<<S as Service>::Error>

source§

impl<S, F> Service for RetryService<S::Error, S, F>where S: Service + Retryable<S::Input, S::Error>, F: Fn(usize) -> Result<(), RetryError<S::Error>>,

§

type Input = <S as Service>::Input

§

type Output = <S as Service>::Output

§

type Error = RetryError<<S as Service>::Error>

source§

impl<S: MutService> Service for MutexService<S>

§

type Input = <S as MutService>::Input

§

type Output = <S as MutService>::Output

§

type Error = <S as MutService>::Error

source§

impl<S: Service> Service for ArcService<S>

§

type Input = <S as Service>::Input

§

type Output = <S as Service>::Output

§

type Error = <S as Service>::Error

source§

impl<S: Service> Service for RefCellService<S>

§

type Input = <S as Service>::Input

§

type Output = <S as Service>::Output

§

type Error = <S as Service>::Error

source§

impl<T, S: Service<Input = T>> Service for IntoIterService<S>

§

type Input = Vec<T>

§

type Output = Vec<<S as Service>::Output>

§

type Error = <S as Service>::Error

source§

impl<T, S: Service<Input = T>> Service for MaybeProcessService<S>

§

type Input = Option<T>

§

type Output = Option<<S as Service>::Output>

§

type Error = <S as Service>::Error

source§

impl<T: Clone, B: Borrow<T>> Service for CloneService<T, B>

§

type Input = B

§

type Output = T

§

type Error = Infallible

source§

impl<T: Send + 'static, F: FnOnce() -> T + Send + 'static> Service for SpawnService<F>

§

type Input = F

§

type Output = JoinHandle<T>

§

type Error = Infallible