use header::{Header, HeaderFormat};
use std::fmt::{mod, Show};
use super::util::from_one_raw_str;
#[deriving(Clone, PartialEq, Show)]
pub struct Location(pub String);
deref!(Location -> String)
impl Header for Location {
fn header_name(_: Option<Location>) -> &'static str {
"Location"
}
fn parse_header(raw: &[Vec<u8>]) -> Option<Location> {
from_one_raw_str(raw).map(|s| Location(s))
}
}
impl HeaderFormat for Location {
fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let Location(ref value) = *self;
value.fmt(fmt)
}
}
bench_header!(bench, Location, { vec![b"http://foo.com/hello:3000".to_vec()] })