pub struct CompressedResponse { /* private fields */ }
Expand description

A response with a lazily compressed body.

The compressed body is cached. It therefore uses unsafe to mutate the Options containing the compressed data. This should be fine; we only write once, if the value is None.

Implementations§

Gets the response with an uncompressed body.

Clones the preferred compression type based on accept-encoding header in request and already cached bodies.

If an error occurs, you should respond with an StatusCode::NOT_ACCEPTABLE.

Errors

May return a &str to be used to inform the client what error occurred in content negotiation.

Available on crate feature gzip only.

Gets the gzip compressed version of CompressedResponse::get_identity()

You should use Self::clone_preferred to get the preferred compression instead, as it is available with any set of features

Available on crate feature br only.

Gets the Brotli compressed version of CompressedResponse::get_identity()

You should use Self::clone_preferred to get the preferred compression instead, as it is available with any set of features

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
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