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<AnyBody<Encoder<B>>>
type Response = ServiceResponse<AnyBody<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
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more