[−][src]Trait actix_web::dev::Transform
The Transform
trait defines the interface of a Service factory. Transform
is often implemented for middleware, defining how to manufacture a
middleware Service. A Service that is manufactured by the factory takes
the Service that follows it during execution as a parameter, assuming
ownership of the next Service. A Service can be a variety of types, such
as (but not limited to) another middleware Service, an extractor Service,
other helper Services, or the request handler endpoint Service.
A Service is created by the factory during server initialization.
Config
is a service factory configuration type.
Associated Types
type Request
Requests handled by the service.
type Response
Responses given by the service.
type Error
Errors produced by the service.
type Transform: Service
The TransformService
value created by this factory
type InitError
Errors produced while building a service.
type Future: Future
The future response value.
Required methods
fn new_transform(&self, service: S) -> Self::Future
Creates and returns a new Service component, asynchronously
Provided methods
fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E> where
F: Fn(Self::InitError) -> E,
F: Fn(Self::InitError) -> E,
Map this service's factory error to a different error, returning a new transform service factory.
fn from_err<E>(self) -> TransformFromErr<Self, S, E> where
E: From<Self::InitError>,
E: From<Self::InitError>,
Map this service's init error to any error implementing From
for
this services
Error`.
Note that this function consumes the receiving transform and returns a wrapped version of it.
Implementations on Foreign Types
impl<T, S> Transform<S> for Rc<T> where
T: Transform<S>,
[src]
T: Transform<S>,
type Request = <T as Transform<S>>::Request
type Response = <T as Transform<S>>::Response
type Error = <T as Transform<S>>::Error
type InitError = <T as Transform<S>>::InitError
type Transform = <T as Transform<S>>::Transform
type Future = <T as Transform<S>>::Future
fn new_transform(&self, service: S) -> <T as Transform<S>>::Future
[src]
fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E> where
F: Fn(Self::InitError) -> E,
[src]
F: Fn(Self::InitError) -> E,
fn from_err<E>(self) -> TransformFromErr<Self, S, E> where
E: From<Self::InitError>,
[src]
E: From<Self::InitError>,
impl<T, S> Transform<S> for Arc<T> where
T: Transform<S>,
[src]
T: Transform<S>,
type Request = <T as Transform<S>>::Request
type Response = <T as Transform<S>>::Response
type Error = <T as Transform<S>>::Error
type InitError = <T as Transform<S>>::InitError
type Transform = <T as Transform<S>>::Transform
type Future = <T as Transform<S>>::Future
fn new_transform(&self, service: S) -> <T as Transform<S>>::Future
[src]
fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E> where
F: Fn(Self::InitError) -> E,
[src]
F: Fn(Self::InitError) -> E,
fn from_err<E>(self) -> TransformFromErr<Self, S, E> where
E: From<Self::InitError>,
[src]
E: From<Self::InitError>,
impl<S, E> Transform<S> for Timeout<E> where
S: Service,
[src]
S: Service,
type Request = <S as Service>::Request
type Response = <S as Service>::Response
type Error = TimeoutError<<S as Service>::Error>
type InitError = E
type Transform = TimeoutService<S>
type Future = FutureResult<<Timeout<E> as Transform<S>>::Transform, <Timeout<E> as Transform<S>>::InitError>
fn new_transform(&self, service: S) -> <Timeout<E> as Transform<S>>::Future
[src]
fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E> where
F: Fn(Self::InitError) -> E,
[src]
F: Fn(Self::InitError) -> E,
fn from_err<E>(self) -> TransformFromErr<Self, S, E> where
E: From<Self::InitError>,
[src]
E: From<Self::InitError>,
impl<S> Transform<S> for InFlight where
S: Service,
[src]
S: Service,
type Request = <S as Service>::Request
type Response = <S as Service>::Response
type Error = <S as Service>::Error
type InitError = Infallible
type Transform = InFlightService<S>
type Future = FutureResult<<InFlight as Transform<S>>::Transform, <InFlight as Transform<S>>::InitError>
fn new_transform(&self, service: S) -> <InFlight as Transform<S>>::Future
[src]
fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E> where
F: Fn(Self::InitError) -> E,
[src]
F: Fn(Self::InitError) -> E,
fn from_err<E>(self) -> TransformFromErr<Self, S, E> where
E: From<Self::InitError>,
[src]
E: From<Self::InitError>,
impl<S> Transform<S> for InOrder<S> where
S: Service,
<S as Service>::Response: 'static,
<S as Service>::Future: 'static,
<S as Service>::Error: 'static,
[src]
S: Service,
<S as Service>::Response: 'static,
<S as Service>::Future: 'static,
<S as Service>::Error: 'static,
type Request = <S as Service>::Request
type Response = <S as Service>::Response
type Error = InOrderError<<S as Service>::Error>
type InitError = Infallible
type Transform = InOrderService<S>
type Future = FutureResult<<InOrder<S> as Transform<S>>::Transform, <InOrder<S> as Transform<S>>::InitError>
fn new_transform(&self, service: S) -> <InOrder<S> as Transform<S>>::Future
[src]
fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E> where
F: Fn(Self::InitError) -> E,
[src]
F: Fn(Self::InitError) -> E,
fn from_err<E>(self) -> TransformFromErr<Self, S, E> where
E: From<Self::InitError>,
[src]
E: From<Self::InitError>,
Implementors
impl<S, B> Transform<S> for ErrorHandlers<B> where
S: Service<Request = ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
B: 'static,
[src]
S: Service<Request = ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
B: 'static,
type Request = ServiceRequest
type Response = ServiceResponse<B>
type Error = Error
type InitError = ()
type Transform = ErrorHandlersMiddleware<S, B>
type Future = FutureResult<Self::Transform, Self::InitError>
fn new_transform(&self, service: S) -> Self::Future
[src]
fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E> where
F: Fn(Self::InitError) -> E,
[src]
F: Fn(Self::InitError) -> E,
fn from_err<E>(self) -> TransformFromErr<Self, S, E> where
E: From<Self::InitError>,
[src]
E: From<Self::InitError>,
impl<S, B> Transform<S> for Compress where
B: MessageBody,
S: Service<Request = ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
[src]
B: MessageBody,
S: Service<Request = ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
type Request = ServiceRequest
type Response = ServiceResponse<Encoder<B>>
type Error = Error
type InitError = ()
type Transform = CompressMiddleware<S>
type Future = FutureResult<Self::Transform, Self::InitError>
fn new_transform(&self, service: S) -> Self::Future
[src]
fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E> where
F: Fn(Self::InitError) -> E,
[src]
F: Fn(Self::InitError) -> E,
fn from_err<E>(self) -> TransformFromErr<Self, S, E> where
E: From<Self::InitError>,
[src]
E: From<Self::InitError>,
impl<S, B> Transform<S> for DefaultHeaders where
S: Service<Request = ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
[src]
S: Service<Request = ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
type Request = ServiceRequest
type Response = ServiceResponse<B>
type Error = Error
type InitError = ()
type Transform = DefaultHeadersMiddleware<S>
type Future = FutureResult<Self::Transform, Self::InitError>
fn new_transform(&self, service: S) -> Self::Future
[src]
fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E> where
F: Fn(Self::InitError) -> E,
[src]
F: Fn(Self::InitError) -> E,
fn from_err<E>(self) -> TransformFromErr<Self, S, E> where
E: From<Self::InitError>,
[src]
E: From<Self::InitError>,
impl<S, B> Transform<S> for Logger where
S: Service<Request = ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
B: MessageBody,
[src]
S: Service<Request = ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
B: MessageBody,
type Request = ServiceRequest
type Response = ServiceResponse<StreamLog<B>>
type Error = Error
type InitError = ()
type Transform = LoggerMiddleware<S>
type Future = FutureResult<Self::Transform, Self::InitError>
fn new_transform(&self, service: S) -> Self::Future
[src]
fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E> where
F: Fn(Self::InitError) -> E,
[src]
F: Fn(Self::InitError) -> E,
fn from_err<E>(self) -> TransformFromErr<Self, S, E> where
E: From<Self::InitError>,
[src]
E: From<Self::InitError>,
impl<S, B> Transform<S> for NormalizePath where
S: Service<Request = ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
[src]
S: Service<Request = ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
type Request = ServiceRequest
type Response = ServiceResponse<B>
type Error = Error
type InitError = ()
type Transform = NormalizePathNormalization<S>
type Future = FutureResult<Self::Transform, Self::InitError>
fn new_transform(&self, service: S) -> Self::Future
[src]
fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E> where
F: Fn(Self::InitError) -> E,
[src]
F: Fn(Self::InitError) -> E,
fn from_err<E>(self) -> TransformFromErr<Self, S, E> where
E: From<Self::InitError>,
[src]
E: From<Self::InitError>,