Skip to content

Commit

Permalink
Fix accidental breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
jplatte committed Jul 20, 2023
1 parent 1bca37d commit 5bf2b68
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tower-http/src/compression_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use http::HeaderValue;
use http_body::Body;
use pin_project_lite::pin_project;
use std::{
convert::TryInto,
io,
pin::Pin,
task::{Context, Poll},
Expand Down Expand Up @@ -350,7 +351,7 @@ pub enum CompressionLevel {
/// qualities. The interpretation of this depends on the algorithm chosen
/// and the specific implementation backing it.
/// Qualities are implicitly clamped to the algorithm's maximum.
Precise(i32),
Precise(u32),
}

impl Default for CompressionLevel {
Expand Down Expand Up @@ -379,7 +380,9 @@ impl CompressionLevel {
CompressionLevel::Fastest => AsyncCompressionLevel::Fastest,
CompressionLevel::Best => AsyncCompressionLevel::Best,
CompressionLevel::Default => AsyncCompressionLevel::Default,
CompressionLevel::Precise(quality) => AsyncCompressionLevel::Precise(quality),
CompressionLevel::Precise(quality) => {
AsyncCompressionLevel::Precise(quality.try_into().unwrap_or(i32::MAX))
}
}
}
}

0 comments on commit 5bf2b68

Please sign in to comment.