pub struct Compat<T> { /* private fields */ }
Expand description
Middleware for enabling any middleware to be used in Resource::wrap
,
and Condition
.
§Examples
use actix_web::middleware::{Logger, Compat};
use actix_web::{App, web};
let logger = Logger::default();
// this would not compile because of incompatible body types
// let app = App::new()
// .service(web::scope("scoped").wrap(logger));
// by using this middleware we can use the logger on a scope
let app = App::new()
.service(web::scope("scoped").wrap(Compat::new(logger)));
Implementations§
Trait Implementations§
source§impl<S, T, Req> Transform<S, Req> for Compat<T>
impl<S, T, Req> Transform<S, Req> for Compat<T>
source§type Response = ServiceResponse
type Response = ServiceResponse
Responses produced by the service.
source§type Transform = CompatMiddleware<<T as Transform<S, Req>>::Transform>
type Transform = CompatMiddleware<<T as Transform<S, Req>>::Transform>
The
TransformService
value created by this factorysource§type InitError = <T as Transform<S, Req>>::InitError
type InitError = <T as Transform<S, Req>>::InitError
Errors produced while building a transform service.
source§type Future = Pin<Box<dyn Future<Output = Result<<Compat<T> as Transform<S, Req>>::Transform, <Compat<T> as Transform<S, Req>>::InitError>>>>
type Future = Pin<Box<dyn Future<Output = Result<<Compat<T> as Transform<S, Req>>::Transform, <Compat<T> as Transform<S, Req>>::InitError>>>>
The future response value.
source§fn new_transform(&self, service: S) -> Self::Future
fn new_transform(&self, service: S) -> Self::Future
Creates and returns a new Transform component, asynchronously
Auto Trait Implementations§
impl<T> Freeze for Compat<T>where
T: Freeze,
impl<T> RefUnwindSafe for Compat<T>where
T: RefUnwindSafe,
impl<T> Send for Compat<T>where
T: Send,
impl<T> Sync for Compat<T>where
T: Sync,
impl<T> Unpin for Compat<T>where
T: Unpin,
impl<T> UnwindSafe for Compat<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more