Struct actix_service::Pipeline [−][src]
Pipeline service - pipeline allows to compose multiple service into one service.
Implementations
impl<S, Req> Pipeline<S, Req> where
S: Service<Req>,
[src]
S: Service<Req>,
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]
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>,
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]
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>,
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]
Self: Sized,
F: FnMut(S::Response) -> R,
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]
Self: Sized,
F: Fn(S::Error) -> E,
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]
T: Clone,
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[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.
fn poll_ready(&self, ctx: &mut Context<'_>) -> Poll<Result<(), S::Error>>
[src]
fn call(&self, req: Req) -> Self::Future
[src]
Auto Trait Implementations
impl<S, Req> Send for Pipeline<S, Req> where
Req: Send,
S: Send,
[src]
Req: Send,
S: Send,
impl<S, Req> Sync for Pipeline<S, Req> where
Req: Sync,
S: Sync,
[src]
Req: Sync,
S: Sync,
impl<S, Req> Unpin for Pipeline<S, Req> where
Req: Unpin,
S: Unpin,
[src]
Req: Unpin,
S: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<S, Req> IntoService<S, Req> for S where
S: Service<Req>,
[src]
S: Service<Req>,
pub fn into_service(Self) -> S
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,