Struct actix_web::middleware::Compress [−][src]
pub struct Compress(_);
Expand description
Middleware for compressing response payloads.
Use BodyEncoding
trait for overriding response compression. To disable compression set
encoding to ContentEncoding::Identity
.
Examples
use actix_web::{web, middleware, App, HttpResponse};
let app = App::new()
.wrap(middleware::Compress::default())
.default_service(web::to(|| HttpResponse::NotFound()));
Implementations
Create new Compress
middleware with the specified encoding.
Trait Implementations
impl<S, B> Transform<S, ServiceRequest> for Compress where
B: MessageBody,
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
impl<S, B> Transform<S, ServiceRequest> for Compress where
B: MessageBody,
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
type Response = ServiceResponse<ResponseBody<Encoder<B>>>
type Response = ServiceResponse<ResponseBody<Encoder<B>>>
Responses produced by the service.
type Transform = CompressMiddleware<S>
type Transform = CompressMiddleware<S>
The TransformService
value created by this factory
Creates and returns a new Transform component, asynchronously
Auto Trait Implementations
impl RefUnwindSafe for Compress
impl UnwindSafe for Compress
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self