Skip to main content

sark_http/h1/head/response/
coding.rs

1/// Content decoding supported by the complete response field section.
2/// Multiple or unknown content codings, or remaining transfer codings, retain
3/// their original representation.
4#[derive(Clone, Copy, Default, Debug, PartialEq, Eq)]
5#[repr(u8)]
6pub enum Coding {
7    #[default]
8    None,
9    Gzip,
10    Unsupported,
11}
12
13impl Coding {
14    pub(super) fn observe(self, value: &[u8]) -> Self {
15        if self == Self::None && value.eq_ignore_ascii_case(b"gzip") {
16            Self::Gzip
17        } else {
18            Self::Unsupported
19        }
20    }
21}