Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(decoder): compile-time validation of decoder header value #2580

Merged
merged 12 commits into from
Mar 5, 2025
10 changes: 5 additions & 5 deletions src/async_impl/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ impl Accepts {
}
*/

pub(super) fn as_str(&self) -> Option<&'static str> {
pub(super) const fn as_str(&self) -> Option<&'static str> {
match (
self.is_gzip(),
self.is_brotli(),
Expand All @@ -623,7 +623,7 @@ impl Accepts {
}
}

fn is_gzip(&self) -> bool {
const fn is_gzip(&self) -> bool {
#[cfg(feature = "gzip")]
{
self.gzip
Expand All @@ -635,7 +635,7 @@ impl Accepts {
}
}

fn is_brotli(&self) -> bool {
const fn is_brotli(&self) -> bool {
#[cfg(feature = "brotli")]
{
self.brotli
Expand All @@ -647,7 +647,7 @@ impl Accepts {
}
}

fn is_zstd(&self) -> bool {
const fn is_zstd(&self) -> bool {
#[cfg(feature = "zstd")]
{
self.zstd
Expand All @@ -659,7 +659,7 @@ impl Accepts {
}
}

fn is_deflate(&self) -> bool {
const fn is_deflate(&self) -> bool {
#[cfg(feature = "deflate")]
{
self.deflate
Expand Down
Loading