kutil_http/headers/
custom.rs1use super::headers::*;
2
3use {http::*, std::time::*};
4
5pub const XX_CACHE: HeaderName = HeaderName::from_static("xx-cache");
7
8pub const XX_CACHE_DURATION: HeaderName = HeaderName::from_static("xx-cache-duration");
10
11pub const XX_ENCODE: HeaderName = HeaderName::from_static("xx-encode");
13
14pub const CONTENT_DIGEST: HeaderName = HeaderName::from_static("content-digest");
20
21pub trait CustomHeaderValues {
27 fn xx_cache(&self, default: bool) -> bool;
29
30 fn xx_cache_duration(&self) -> Option<Duration>;
32
33 fn xx_encode(&self, default: bool) -> bool;
35}
36
37impl CustomHeaderValues for HeaderMap {
38 fn xx_cache(&self, default: bool) -> bool {
39 self.bool_value(XX_CACHE, default)
40 }
41
42 fn xx_cache_duration(&self) -> Option<Duration> {
43 self.duration_value(XX_CACHE_DURATION)
44 }
45
46 fn xx_encode(&self, default: bool) -> bool {
47 self.bool_value(XX_ENCODE, default)
48 }
49}