pub struct Encoder<B> { /* private fields */ }Expand description
Response body encoder.
Compresses a response body with the selected content encoding.
Implementations§
Source§impl<B: MessageBody> Encoder<B>
impl<B: MessageBody> Encoder<B>
Sourcepub fn response(
encoding: ContentEncoding,
head: &mut ResponseHead,
body: ResponseBody<B>,
) -> ResponseBody<B>
pub fn response( encoding: ContentEncoding, head: &mut ResponseHead, body: ResponseBody<B>, ) -> ResponseBody<B>
Wrap a response body in an encoder for encoding.
On success the Content-Encoding header is set and chunked
transfer-encoding is enabled. The body is returned unchanged if the
encoding is not supported, is Identity or Auto, if the response
already has a Content-Encoding header, if the status is
101 Switching Protocols or 204 No Content, or if the body is empty
or its size is known to be below 1KiB.
Trait Implementations§
Auto Trait Implementations§
impl<B> !RefUnwindSafe for Encoder<B>
impl<B> !Send for Encoder<B>
impl<B> !Sync for Encoder<B>
impl<B> !UnwindSafe for Encoder<B>
impl<B> Freeze for Encoder<B>where
B: Freeze,
impl<B> Unpin for Encoder<B>where
B: Unpin,
impl<B> UnsafeUnpin for Encoder<B>where
B: UnsafeUnpin,
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