@@ -44,17 +44,32 @@ pub struct CacheControl {
4444 s_max_age : Option < Seconds > ,
4545}
4646
47- bitflags ! {
48- struct Flags : u32 {
49- const NO_CACHE = 0b000000001 ;
50- const NO_STORE = 0b000000010 ;
51- const NO_TRANSFORM = 0b000000100 ;
52- const ONLY_IF_CACHED = 0b000001000 ;
53- const MUST_REVALIDATE = 0b000010000 ;
54- const PUBLIC = 0b000100000 ;
55- const PRIVATE = 0b001000000 ;
56- const PROXY_REVALIDATE = 0b010000000 ;
57- const IMMUTABLE = 0b100000000 ;
47+ #[ derive( Debug , Clone , PartialEq ) ]
48+ struct Flags {
49+ bits : u64 ,
50+ }
51+
52+ impl Flags {
53+ const NO_CACHE : Self = Self { bits : 0b000000001 } ;
54+ const NO_STORE : Self = Self { bits : 0b000000010 } ;
55+ const NO_TRANSFORM : Self = Self { bits : 0b000000100 } ;
56+ const ONLY_IF_CACHED : Self = Self { bits : 0b000001000 } ;
57+ const MUST_REVALIDATE : Self = Self { bits : 0b000010000 } ;
58+ const PUBLIC : Self = Self { bits : 0b000100000 } ;
59+ const PRIVATE : Self = Self { bits : 0b001000000 } ;
60+ const PROXY_REVALIDATE : Self = Self { bits : 0b010000000 } ;
61+ const IMMUTABLE : Self = Self { bits : 0b100000000 } ;
62+
63+ fn empty ( ) -> Self {
64+ Self { bits : 0 }
65+ }
66+
67+ fn contains ( & self , flag : Self ) -> bool {
68+ ( self . bits & flag. bits ) != 0
69+ }
70+
71+ fn insert ( & mut self , flag : Self ) {
72+ self . bits |= flag. bits ;
5873 }
5974}
6075
0 commit comments