Struct actix_web::middleware::Compat[][src]

pub struct Compat<T> { /* fields omitted */ }

Middleware for enabling any middleware to be used in Resource::wrap, Scope::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

impl<T> Compat<T>[src]

pub fn new(middleware: T) -> Self[src]

Wrap a middleware to give it broader compatibility.

Trait Implementations

impl<S, T, Req> Transform<S, Req> for Compat<T> where
    S: Service<Req>,
    T: Transform<S, Req>,
    T::Future: 'static,
    T::Response: MapServiceResponseBody,
    Error: From<T::Error>, 
[src]

type Response = ServiceResponse

Responses given by the service.

type Error = Error

Errors produced by the service.

type Transform = CompatMiddleware<T::Transform>

The TransformService value created by this factory

type InitError = T::InitError

Errors produced while building a transform service.

type Future = LocalBoxFuture<'static, Result<Self::Transform, Self::InitError>>

The future response value.

Auto Trait Implementations

impl<T> RefUnwindSafe for Compat<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for Compat<T> where
    T: Send
[src]

impl<T> Sync for Compat<T> where
    T: Sync
[src]

impl<T> Unpin for Compat<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for Compat<T> where
    T: UnwindSafe
[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> Instrument for T[src]

impl<T> Instrument for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,