1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use std::fmt;
use header;
#[derive(Clone, Copy, PartialEq, Debug)]
pub struct AccessControlMaxAge(pub u32);
impl header::Header for AccessControlMaxAge {
#[inline]
fn header_name() -> &'static str {
"Access-Control-Max-Age"
}
fn parse_header(raw: &[Vec<u8>]) -> Option<AccessControlMaxAge> {
header::parsing::from_one_raw_str(raw).map(AccessControlMaxAge)
}
}
impl header::HeaderFormat for AccessControlMaxAge {
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
let AccessControlMaxAge(ref num) = *self;
write!(f, "{}", num)
}
}