pub struct ContentEncoding(/* private fields */);Expand description
Content-Encoding header, defined in
RFC7231
The Content-Encoding header field indicates what content codings
have been applied to the representation, beyond those inherent in the
media type, and thus what decoding mechanisms have to be applied in
order to obtain data in the media type referenced by the Content-Type
header field. Content-Encoding is primarily used to allow a
representation’s data to be compressed without losing the identity of
its underlying media type.
§ABNF
Content-Encoding = 1#content-coding§Example values
gzipbrzstd
§Examples
use headers::ContentEncoding;
let content_enc = ContentEncoding::gzip();Implementations§
Source§impl ContentEncoding
impl ContentEncoding
Sourcepub fn gzip() -> ContentEncoding
pub fn gzip() -> ContentEncoding
A constructor to easily create a Content-Encoding: gzip header.
Sourcepub fn brotli() -> ContentEncoding
pub fn brotli() -> ContentEncoding
A constructor to easily create a Content-Encoding: br header.
Sourcepub fn zstd() -> ContentEncoding
pub fn zstd() -> ContentEncoding
A constructor to easily create a Content-Encoding: zstd header.
Sourcepub fn contains(&self, coding: impl AsCoding) -> bool
pub fn contains(&self, coding: impl AsCoding) -> bool
Check if this header contains a given “coding”.
This can be used with these argument types:
&str
§Example
use headers::ContentEncoding;
let content_enc = ContentEncoding::gzip();
assert!(content_enc.contains("gzip"));
assert!(!content_enc.contains("br"));Trait Implementations§
Source§impl Clone for ContentEncoding
impl Clone for ContentEncoding
Source§fn clone(&self) -> ContentEncoding
fn clone(&self) -> ContentEncoding
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more