1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 06:39:22 +02:00

improve docs for Compress

This commit is contained in:
Rob Ede
2022-01-03 14:59:01 +00:00
parent 25fe1bbaa5
commit 68cd853aa2
4 changed files with 47 additions and 42 deletions

View File

@ -73,7 +73,7 @@ impl<B: MessageBody> Encoder<B> {
if should_encode {
// wrap body only if encoder is feature-enabled
if let Some(enc) = ContentEncoder::encoder(encoding) {
if let Some(enc) = ContentEncoder::select(encoding) {
update_head(encoding, head);
return Encoder {
@ -168,6 +168,7 @@ where
cx: &mut Context<'_>,
) -> Poll<Option<Result<Bytes, Self::Error>>> {
let mut this = self.project();
loop {
if *this.eof {
return Poll::Ready(None);
@ -276,7 +277,7 @@ enum ContentEncoder {
}
impl ContentEncoder {
fn encoder(encoding: ContentEncoding) -> Option<Self> {
fn select(encoding: ContentEncoding) -> Option<Self> {
match encoding {
#[cfg(feature = "compress-gzip")]
ContentEncoding::Deflate => Some(ContentEncoder::Deflate(ZlibEncoder::new(