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
use header::{Charset, QualityItem};
#[derive(Clone, PartialEq, Debug)]
pub struct AcceptCharset(pub Vec<QualityItem<Charset>>);
impl_list_header!(AcceptCharset,
"Accept-Charset",
Vec<QualityItem<Charset>>);
#[test]
fn test_parse_header() {
use header::{self, q};
let a: AcceptCharset = header::Header::parse_header(
[b"iso-8859-5, iso-8859-6;q=0.8".to_vec()].as_slice()).unwrap();
let b = AcceptCharset(vec![
QualityItem { item: Charset::Iso_8859_5, quality: q(1.0) },
QualityItem { item: Charset::Iso_8859_6, quality: q(0.8) },
]);
assert_eq!(format!("{}", a), format!("{}", b));
assert_eq!(a, b);
}