Skip to content

Commit

Permalink
perf(decoder): compile-time validation of decoder header value (#2580)
Browse files Browse the repository at this point in the history
  • Loading branch information
0x676e67 authored Mar 5, 2025
1 parent 0bcba46 commit 44ac897
Showing 1 changed file with 5 additions and 5 deletions.
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

0 comments on commit 44ac897

Please sign in to comment.