Skip to main content

AsyncOperator

Trait AsyncOperator 

Source
pub trait AsyncOperator<I> {
    type Output;
    type Error;
    type Future<'a>: Future<Output = Result<Self::Output, Self::Error>>
       where Self: 'a;

    // Required methods
    fn poll_ready(
        &mut self,
        cx: &mut Context<'_>,
    ) -> Poll<Result<(), Self::Error>>;
    fn next(&mut self, input: I) -> Self::Future<'_>;
}
Expand description

Async Operator. It can be seen as an alias of tower_service::Service.

Required Associated Types§

Source

type Output

Output type.

Source

type Error

Error type.

Source

type Future<'a>: Future<Output = Result<Self::Output, Self::Error>> where Self: 'a

The future output value.

Required Methods§

Source

fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>

Check if the operator is ready to process the next input.

Source

fn next(&mut self, input: I) -> Self::Future<'_>

Process the next input.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<I, E, F, P> AsyncOperator<I> for MapErr<F, P>
where P: AsyncOperator<I>, F: FnMut(P::Error) -> E,

Source§

type Output = <P as AsyncOperator<I>>::Output

Source§

type Error = E

Source§

type Future<'a> = MapErr<<P as AsyncOperator<I>>::Future<'a>, &'a mut F> where P: 'a, F: 'a

Source§

impl<I, E, P1, P2> AsyncOperator<I> for Then<I, P1, P2>
where P1: AsyncOperator<I, Error = E>, P2: AsyncOperator<P1::Output, Error = E>,

Source§

type Output = <P2 as AsyncOperator<<P1 as AsyncOperator<I>>::Output>>::Output

Source§

type Error = E

Source§

type Future<'a> = AndThenFuture<'a, <P1 as AsyncOperator<I>>::Future<'a>, P2> where I: 'a, P1: 'a, P2: 'a

Source§

impl<P, I, O> AsyncOperator<I> for Next<P>
where P: Operator<I, Output = O>,

Source§

type Output = O

Source§

type Error = Infallible

Source§

type Future<'a> = Ready<Result<<Next<P> as AsyncOperator<I>>::Output, <Next<P> as AsyncOperator<I>>::Error>> where P: 'a

Source§

impl<S, I, O> AsyncOperator<I> for ServiceOp<S>
where S: Service<I, Response = O>,

Source§

type Output = O

Source§

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

Source§

type Future<'a> = <S as Service<I>>::Future where S: 'a