pub struct CompressedResponse { /* private fields */ }
Expand description
Implementations§
source§impl CompressedResponse
impl CompressedResponse
sourcepub fn get_identity(&self) -> &Response<Bytes>
pub fn get_identity(&self) -> &Response<Bytes>
Gets the response with an uncompressed body.
sourcepub async fn clone_preferred<T>(
&self,
request: &Request<T>,
regular_options: &CompressionOptions,
cached_options: &CompressionOptions,
do_cache: bool,
) -> Result<Response<Bytes>, &'static str>
pub async fn clone_preferred<T>( &self, request: &Request<T>, regular_options: &CompressionOptions, cached_options: &CompressionOptions, do_cache: bool, ) -> Result<Response<Bytes>, &'static str>
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.
sourcepub async fn get_gzip(&self, level: u32) -> &Bytes
Available on crate feature gzip
only.
pub async fn get_gzip(&self, level: u32) -> &Bytes
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
sourcepub async fn get_br(&self, level: u32) -> &Bytes
Available on crate feature br
only.
pub async fn get_br(&self, level: u32) -> &Bytes
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
sourcepub async fn get_zstd(&self, level: i32) -> &Bytes
Available on crate feature zstd
only.
pub async fn get_zstd(&self, level: i32) -> &Bytes
zstd
only.Gets the Zstd 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