Struct actix_service::Pipeline[][src]

pub struct Pipeline<S, Req> { /* fields omitted */ }

Pipeline service - pipeline allows to compose multiple service into one service.

Implementations

impl<S, Req> Pipeline<S, Req> where
    S: Service<Req>, 
[src]

pub fn and_then<I, S1>(
    self,
    service: I
) -> Pipeline<impl Service<Req, Response = S1::Response, Error = S::Error> + Clone, Req> where
    Self: Sized,
    I: IntoService<S1, S::Response>,
    S1: Service<S::Response, Error = S::Error>, 
[src]

Call another service after call to this one has resolved successfully.

This function can be used to chain two services together and ensure that the second service isn't called until call to the fist service have finished. Result of the call to the first service is used as an input parameter for the second service's call.

Note that this function consumes the receiving service and returns a wrapped version of it.

pub fn then<F, S1>(
    self,
    service: F
) -> Pipeline<impl Service<Req, Response = S1::Response, Error = S::Error> + Clone, Req> where
    Self: Sized,
    F: IntoService<S1, Result<S::Response, S::Error>>,
    S1: Service<Result<S::Response, S::Error>, Error = S::Error>, 
[src]

Chain on a computation for when a call to the service finished, passing the result of the call to the next service U.

Note that this function consumes the receiving pipeline and returns a wrapped version of it.

pub fn map<F, R>(self, f: F) -> Pipeline<Map<S, F, Req, R>, Req> where
    Self: Sized,
    F: FnMut(S::Response) -> R, 
[src]

Map this service's output to a different type, returning a new service of the resulting type.

This function is similar to the Option::map or Iterator::map where it will change the type of the underlying service.

Note that this function consumes the receiving service and returns a wrapped version of it, similar to the existing map methods in the standard library.

pub fn map_err<F, E>(self, f: F) -> Pipeline<MapErr<S, Req, F, E>, Req> where
    Self: Sized,
    F: Fn(S::Error) -> E, 
[src]

Map this service's error to a different error, returning a new service.

This function is similar to the Result::map_err where it will change the error type of the underlying service. This is useful for example to ensure that services have the same error type.

Note that this function consumes the receiving service and returns a wrapped version of it.

Trait Implementations

impl<T, Req> Clone for Pipeline<T, Req> where
    T: Clone
[src]

impl<S: Service<Req>, Req> Service<Req> for Pipeline<S, Req>[src]

type Response = S::Response

Responses given by the service.

type Error = S::Error

Errors produced by the service when polling readiness or executing call.

type Future = S::Future

The future response value.

Auto Trait Implementations

impl<S, Req> Send for Pipeline<S, Req> where
    Req: Send,
    S: Send
[src]

impl<S, Req> Sync for Pipeline<S, Req> where
    Req: Sync,
    S: Sync
[src]

impl<S, Req> Unpin for Pipeline<S, Req> where
    Req: Unpin,
    S: Unpin
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<S, Req> IntoService<S, Req> for S where
    S: Service<Req>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.