web_static_pack/
cache_control.rs1use crate::common::cache_control::{CacheControl as CacheControl_, CacheControlArchived};
4use http::HeaderValue;
5
6#[derive(Debug)]
10pub enum CacheControl {
11 NoCache,
13 MaxCache,
15}
16impl CacheControl {
17 pub fn cache_control(&self) -> HeaderValue {
19 match self {
20 CacheControl::NoCache => HeaderValue::from_static("no-cache"),
21 CacheControl::MaxCache => HeaderValue::from_static("max-age=31536000, immutable"),
22 }
23 }
24}
25impl From<CacheControl_> for CacheControl {
26 fn from(value: CacheControl_) -> Self {
27 match value {
28 CacheControl_::NoCache => Self::NoCache,
29 CacheControl_::MaxCache => Self::MaxCache,
30 }
31 }
32}
33impl From<CacheControlArchived> for CacheControl {
34 fn from(value: CacheControlArchived) -> Self {
35 match value {
36 CacheControlArchived::NoCache => Self::NoCache,
37 CacheControlArchived::MaxCache => Self::MaxCache,
38 }
39 }
40}