@@ -74,16 +74,6 @@ impl Vary {
74
74
Ok ( Some ( Self { entries, wildcard } ) )
75
75
}
76
76
77
- /// Sets the `If-Match` header.
78
- pub fn apply ( & self , mut headers : impl AsMut < Headers > ) {
79
- headers. as_mut ( ) . insert ( VARY , self . header_value ( ) ) ;
80
- }
81
-
82
- /// Get the `HeaderName`.
83
- pub fn name ( & self ) -> HeaderName {
84
- VARY
85
- }
86
-
87
77
/// Returns `true` if a wildcard directive was set.
88
78
pub fn wildcard ( & self ) -> bool {
89
79
self . wildcard
@@ -94,31 +84,6 @@ impl Vary {
94
84
self . wildcard = wildcard
95
85
}
96
86
97
- /// Get the `HeaderValue`.
98
- pub fn value ( & self ) -> HeaderValue {
99
- let mut output = String :: new ( ) ;
100
- for ( n, name) in self . entries . iter ( ) . enumerate ( ) {
101
- let directive: HeaderValue = name
102
- . as_str ( )
103
- . parse ( )
104
- . expect ( "Could not convert a HeaderName into a HeaderValue" ) ;
105
- match n {
106
- 0 => write ! ( output, "{}" , directive) . unwrap ( ) ,
107
- _ => write ! ( output, ", {}" , directive) . unwrap ( ) ,
108
- } ;
109
- }
110
-
111
- if self . wildcard {
112
- match output. len ( ) {
113
- 0 => write ! ( output, "*" ) . unwrap ( ) ,
114
- _ => write ! ( output, ", *" ) . unwrap ( ) ,
115
- } ;
116
- }
117
-
118
- // SAFETY: the internal string is validated to be ASCII.
119
- unsafe { HeaderValue :: from_bytes_unchecked ( output. into ( ) ) }
120
- }
121
-
122
87
/// Push a directive into the list of entries.
123
88
pub fn push ( & mut self , directive : impl Into < HeaderName > ) -> crate :: Result < ( ) > {
124
89
self . entries . push ( directive. into ( ) ) ;
@@ -144,8 +109,29 @@ impl Header for Vary {
144
109
fn header_name ( & self ) -> HeaderName {
145
110
VARY
146
111
}
112
+
147
113
fn header_value ( & self ) -> HeaderValue {
148
- self . header_value ( )
114
+ let mut output = String :: new ( ) ;
115
+ for ( n, name) in self . entries . iter ( ) . enumerate ( ) {
116
+ let directive: HeaderValue = name
117
+ . as_str ( )
118
+ . parse ( )
119
+ . expect ( "Could not convert a HeaderName into a HeaderValue" ) ;
120
+ match n {
121
+ 0 => write ! ( output, "{}" , directive) . unwrap ( ) ,
122
+ _ => write ! ( output, ", {}" , directive) . unwrap ( ) ,
123
+ } ;
124
+ }
125
+
126
+ if self . wildcard {
127
+ match output. len ( ) {
128
+ 0 => write ! ( output, "*" ) . unwrap ( ) ,
129
+ _ => write ! ( output, ", *" ) . unwrap ( ) ,
130
+ } ;
131
+ }
132
+
133
+ // SAFETY: the internal string is validated to be ASCII.
134
+ unsafe { HeaderValue :: from_bytes_unchecked ( output. into ( ) ) }
149
135
}
150
136
}
151
137
0 commit comments