pub struct ContentEncoding { /* private fields */ }
Expand description
Specify the compression algorithm.
§Specifications
§Examples
use http_types::Response;
use http_types::content::{ContentEncoding, Encoding};
let mut encoding = ContentEncoding::new(Encoding::Gzip);
let mut res = Response::new(200);
encoding.apply(&mut res);
let encoding = ContentEncoding::from_headers(res)?.unwrap();
assert_eq!(encoding, &Encoding::Gzip);
Implementations§
Source§impl ContentEncoding
impl ContentEncoding
Sourcepub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>
pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>
Create a new instance from headers.
Sourcepub fn name(&self) -> HeaderName
pub fn name(&self) -> HeaderName
Get the HeaderName
.
Sourcepub fn value(&self) -> HeaderValue
pub fn value(&self) -> HeaderValue
Get the HeaderValue
.
Trait Implementations§
Source§impl Debug for ContentEncoding
impl Debug for ContentEncoding
Source§impl Deref for ContentEncoding
impl Deref for ContentEncoding
Source§impl DerefMut for ContentEncoding
impl DerefMut for ContentEncoding
Source§impl From<&Encoding> for ContentEncoding
impl From<&Encoding> for ContentEncoding
Source§impl From<&EncodingProposal> for ContentEncoding
impl From<&EncodingProposal> for ContentEncoding
Source§fn from(encoding: &EncodingProposal) -> Self
fn from(encoding: &EncodingProposal) -> Self
Converts to this type from the input type.
Source§impl From<Encoding> for ContentEncoding
impl From<Encoding> for ContentEncoding
Source§impl From<EncodingProposal> for ContentEncoding
impl From<EncodingProposal> for ContentEncoding
Source§fn from(encoding: EncodingProposal) -> Self
fn from(encoding: EncodingProposal) -> Self
Converts to this type from the input type.
Source§impl PartialEq<&Encoding> for ContentEncoding
impl PartialEq<&Encoding> for ContentEncoding
Source§impl PartialEq<Encoding> for ContentEncoding
impl PartialEq<Encoding> for ContentEncoding
Source§impl ToHeaderValues for ContentEncoding
impl ToHeaderValues for ContentEncoding
Source§type Iter = IntoIter<HeaderValue>
type Iter = IntoIter<HeaderValue>
Returned iterator over header values which this type may correspond to.
Source§fn to_header_values(&self) -> Result<Self::Iter>
fn to_header_values(&self) -> Result<Self::Iter>
Converts this object to an iterator of resolved
HeaderValues
.Auto Trait Implementations§
impl Freeze for ContentEncoding
impl RefUnwindSafe for ContentEncoding
impl Send for ContentEncoding
impl Sync for ContentEncoding
impl Unpin for ContentEncoding
impl UnwindSafe for ContentEncoding
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more