| @@ -72,7 +72,7 @@ pub enum CacheDirective { | ||||
| impl fmt::String for CacheDirective { | ||||
|     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||||
|         use self::CacheDirective::*; | ||||
|         match *self { | ||||
|         fmt::String::fmt(match *self { | ||||
|             NoCache => "no-cache", | ||||
|             NoStore => "no-store", | ||||
|             NoTransform => "no-transform", | ||||
| @@ -91,7 +91,7 @@ impl fmt::String for CacheDirective { | ||||
|             Extension(ref name, None) => &name[], | ||||
|             Extension(ref name, Some(ref arg)) => return write!(f, "{}={}", name, arg), | ||||
|  | ||||
|         }.fmt(f) | ||||
|         }, f) | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| use header::{Header, HeaderFormat}; | ||||
| use std::fmt::{self, Show}; | ||||
| use std::fmt; | ||||
| use std::str::FromStr; | ||||
| use header::shared::util::{from_comma_delimited, fmt_comma_delimited}; | ||||
|  | ||||
| @@ -12,7 +12,7 @@ pub struct Connection(pub Vec<ConnectionOption>); | ||||
| deref!(Connection => Vec<ConnectionOption>); | ||||
|  | ||||
| /// Values that can be in the `Connection` header. | ||||
| #[derive(Clone, PartialEq)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub enum ConnectionOption { | ||||
|     /// The `keep-alive` connection value. | ||||
|     KeepAlive, | ||||
| @@ -49,12 +49,6 @@ impl fmt::String for ConnectionOption { | ||||
|     } | ||||
| } | ||||
|  | ||||
| impl fmt::Show for ConnectionOption { | ||||
|     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | ||||
| 		self.to_string().fmt(fmt) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| impl Header for Connection { | ||||
|     fn header_name(_: Option<Connection>) -> &'static str { | ||||
|         "Connection" | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| use header::{Header, HeaderFormat}; | ||||
| use std::fmt::{self, String}; | ||||
| use std::fmt; | ||||
| use header::shared::util::from_one_raw_str; | ||||
| use mime::Mime; | ||||
|  | ||||
| @@ -24,8 +24,7 @@ impl Header for ContentType { | ||||
|  | ||||
| impl HeaderFormat for ContentType { | ||||
|     fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | ||||
|         let ContentType(ref value) = *self; | ||||
|         value.fmt(fmt) | ||||
|         fmt::String::fmt(&self.0, fmt) | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| use std::fmt::{self, Show}; | ||||
| use std::fmt; | ||||
| use std::str::FromStr; | ||||
| use time::Tm; | ||||
| use header::{Header, HeaderFormat}; | ||||
| @@ -7,7 +7,7 @@ use header::shared::time::tm_from_str; | ||||
|  | ||||
| // Egh, replace as soon as something better than time::Tm exists. | ||||
| /// The `Date` header field. | ||||
| #[derive(Copy, PartialEq, Clone)] | ||||
| #[derive(Copy, PartialEq, Clone, Show)] | ||||
| pub struct Date(pub Tm); | ||||
|  | ||||
| deref!(Date => Tm); | ||||
| @@ -25,11 +25,12 @@ impl Header for Date { | ||||
|  | ||||
| impl HeaderFormat for Date { | ||||
|     fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | ||||
|         let tm = **self; | ||||
|         match tm.tm_utcoff { | ||||
|             0 => tm.rfc822().fmt(fmt), | ||||
|             _ => tm.to_utc().rfc822().fmt(fmt) | ||||
|         } | ||||
|         let tm = self.0; | ||||
|         let tm = match tm.tm_utcoff { | ||||
|             0 => tm, | ||||
|             _ => tm.to_utc(), | ||||
|         }; | ||||
|         fmt::String::fmt(&tm.rfc822(), fmt) | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| use std::fmt::{self, Show}; | ||||
| use std::fmt; | ||||
| use std::str::FromStr; | ||||
| use time::Tm; | ||||
| use header::{Header, HeaderFormat}; | ||||
| @@ -6,7 +6,7 @@ use header::shared::util::from_one_raw_str; | ||||
| use header::shared::time::tm_from_str; | ||||
|  | ||||
| /// The `Expires` header field. | ||||
| #[derive(Copy, PartialEq, Clone)] | ||||
| #[derive(Copy, PartialEq, Clone, Show)] | ||||
| pub struct Expires(pub Tm); | ||||
|  | ||||
| deref!(Expires => Tm); | ||||
| @@ -24,11 +24,12 @@ impl Header for Expires { | ||||
|  | ||||
| impl HeaderFormat for Expires { | ||||
|     fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | ||||
|         let tm = **self; | ||||
|         match tm.tm_utcoff { | ||||
|             0 => tm.rfc822().fmt(fmt), | ||||
|             _ => tm.to_utc().rfc822().fmt(fmt) | ||||
|         } | ||||
|         let tm = self.0; | ||||
|         let tm = match tm.tm_utcoff { | ||||
|             0 => tm, | ||||
|             _ => tm.to_utc(), | ||||
|         }; | ||||
|         fmt::String::fmt(&tm.rfc822(), fmt) | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| use std::fmt::{self, Show}; | ||||
| use std::fmt; | ||||
| use std::str::FromStr; | ||||
| use time::Tm; | ||||
| use header::{Header, HeaderFormat}; | ||||
| @@ -6,7 +6,7 @@ use header::shared::util::from_one_raw_str; | ||||
| use header::shared::time::tm_from_str; | ||||
|  | ||||
| /// The `If-Modified-Since` header field. | ||||
| #[derive(Copy, PartialEq, Clone)] | ||||
| #[derive(Copy, PartialEq, Clone, Show)] | ||||
| pub struct IfModifiedSince(pub Tm); | ||||
|  | ||||
| deref!(IfModifiedSince => Tm); | ||||
| @@ -24,11 +24,12 @@ impl Header for IfModifiedSince { | ||||
|  | ||||
| impl HeaderFormat for IfModifiedSince { | ||||
|     fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | ||||
|         let tm = **self; | ||||
|         match tm.tm_utcoff { | ||||
|             0 => tm.rfc822().fmt(fmt), | ||||
|             _ => tm.to_utc().rfc822().fmt(fmt) | ||||
|         } | ||||
|         let tm = self.0; | ||||
|         let tm = match tm.tm_utcoff { | ||||
|             0 => tm, | ||||
|             _ => tm.to_utc(), | ||||
|         }; | ||||
|         fmt::String::fmt(&tm.rfc822(), fmt) | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| use std::fmt::{self, Show}; | ||||
| use std::fmt; | ||||
| use std::str::FromStr; | ||||
| use time::Tm; | ||||
| use header::{Header, HeaderFormat}; | ||||
| @@ -6,7 +6,7 @@ use header::shared::util::from_one_raw_str; | ||||
| use header::shared::time::tm_from_str; | ||||
|  | ||||
| /// The `LastModified` header field. | ||||
| #[derive(Copy, PartialEq, Clone)] | ||||
| #[derive(Copy, PartialEq, Clone, Show)] | ||||
| pub struct LastModified(pub Tm); | ||||
|  | ||||
| deref!(LastModified => Tm); | ||||
| @@ -24,11 +24,12 @@ impl Header for LastModified { | ||||
|  | ||||
| impl HeaderFormat for LastModified { | ||||
|     fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | ||||
|         let tm = **self; | ||||
|         match tm.tm_utcoff { | ||||
|             0 => tm.rfc822().fmt(fmt), | ||||
|             _ => tm.to_utc().rfc822().fmt(fmt) | ||||
|         } | ||||
|         let tm = self.0; | ||||
|         let tm = match tm.tm_utcoff { | ||||
|             0 => tm, | ||||
|             _ => tm.to_utc(), | ||||
|         }; | ||||
|         fmt::String::fmt(&tm.rfc822(), fmt) | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| use header::{Header, HeaderFormat}; | ||||
| use std::fmt::{self, Show}; | ||||
| use std::fmt; | ||||
| use header::shared::util::from_one_raw_str; | ||||
|  | ||||
| /// The `Location` header. | ||||
| @@ -30,8 +30,7 @@ impl Header for Location { | ||||
|  | ||||
| impl HeaderFormat for Location { | ||||
|     fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | ||||
|         let Location(ref value) = *self; | ||||
|         value.fmt(fmt) | ||||
|         fmt.write_str(&*self.0) | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| use header::{Header, HeaderFormat}; | ||||
| use std::fmt::{self, Show}; | ||||
| use std::fmt; | ||||
| use header::shared::util::from_one_raw_str; | ||||
|  | ||||
| /// The `Server` header field. | ||||
| @@ -22,8 +22,7 @@ impl Header for Server { | ||||
|  | ||||
| impl HeaderFormat for Server { | ||||
|     fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | ||||
|         let Server(ref value) = *self; | ||||
|         value.fmt(fmt) | ||||
|         fmt.write_str(&*self.0) | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -33,7 +33,7 @@ deref!(TransferEncoding => Vec<Encoding>); | ||||
| /// # use hyper::header::Headers; | ||||
| /// # let mut headers = Headers::new(); | ||||
| /// headers.set(TransferEncoding(vec![Gzip, Chunked])); | ||||
| #[derive(Clone, PartialEq)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub enum Encoding { | ||||
|     /// The `chunked` encoding. | ||||
|     Chunked, | ||||
| @@ -59,12 +59,6 @@ impl fmt::String for Encoding { | ||||
|     } | ||||
| } | ||||
|  | ||||
| impl fmt::Show for Encoding { | ||||
|     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | ||||
| 		self.to_string().fmt(fmt) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| impl FromStr for Encoding { | ||||
|     fn from_str(s: &str) -> Option<Encoding> { | ||||
|         match s { | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| use header::{Header, HeaderFormat}; | ||||
| use std::fmt::{self, Show}; | ||||
| use std::fmt; | ||||
| use std::str::FromStr; | ||||
| use header::shared::util::{from_comma_delimited, fmt_comma_delimited}; | ||||
|  | ||||
| @@ -12,7 +12,7 @@ pub struct Upgrade(pub Vec<Protocol>); | ||||
| deref!(Upgrade => Vec<Protocol>); | ||||
|  | ||||
| /// Protocol values that can appear in the Upgrade header. | ||||
| #[derive(Clone, PartialEq)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub enum Protocol { | ||||
|     /// The websocket protocol. | ||||
|     WebSocket, | ||||
| @@ -38,12 +38,6 @@ impl fmt::String for Protocol { | ||||
|     } | ||||
| } | ||||
|  | ||||
| impl fmt::Show for Protocol { | ||||
|     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | ||||
|         self.to_string().fmt(fmt) | ||||
|     } | ||||
| } | ||||
|  | ||||
| impl Header for Upgrade { | ||||
|     fn header_name(_: Option<Upgrade>) -> &'static str { | ||||
|         "Upgrade" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user