#[deriving] -> #[derive]
This commit is contained in:
		| @@ -25,7 +25,7 @@ use mime; | ||||
| ///     qitem(Mime(Text, Html, vec![])), | ||||
| ///     qitem(Mime(Text, Xml, vec![])) ])); | ||||
| /// ``` | ||||
| #[deriving(Clone, PartialEq, Show)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub struct Accept(pub Vec<shared::QualityItem<mime::Mime>>); | ||||
|  | ||||
| deref!(Accept -> Vec<shared::QualityItem<mime::Mime>>); | ||||
|   | ||||
| @@ -6,7 +6,7 @@ use header::shared::util::{from_comma_delimited, fmt_comma_delimited}; | ||||
| /// The `Allow` header. | ||||
| /// See also https://tools.ietf.org/html/rfc7231#section-7.4.1 | ||||
|  | ||||
| #[deriving(Clone, PartialEq, Show)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub struct Allow(pub Vec<Method>); | ||||
|  | ||||
| deref!(Allow -> Vec<Method>); | ||||
|   | ||||
| @@ -4,7 +4,7 @@ use serialize::base64::{ToBase64, FromBase64, Standard, Config, Newline}; | ||||
| use header::{Header, HeaderFormat}; | ||||
|  | ||||
| /// The `Authorization` header field. | ||||
| #[deriving(Clone, PartialEq, Show)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub struct Authorization<S: Scheme>(pub S); | ||||
|  | ||||
| impl<S: Scheme> Deref<S> for Authorization<S> { | ||||
| @@ -72,7 +72,7 @@ impl Scheme for String { | ||||
| } | ||||
|  | ||||
| /// Credential holder for Basic Authentication | ||||
| #[deriving(Clone, PartialEq, Show)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub struct Basic { | ||||
|     /// The username as a possibly empty string | ||||
|     pub username: String, | ||||
|   | ||||
| @@ -4,7 +4,7 @@ use header::{Header, HeaderFormat}; | ||||
| use header::shared::util::{from_one_comma_delimited, fmt_comma_delimited}; | ||||
|  | ||||
| /// The Cache-Control header. | ||||
| #[deriving(PartialEq, Clone, Show)] | ||||
| #[derive(PartialEq, Clone, Show)] | ||||
| pub struct CacheControl(pub Vec<CacheDirective>); | ||||
|  | ||||
| deref!(CacheControl -> Vec<CacheDirective>); | ||||
| @@ -34,7 +34,7 @@ impl HeaderFormat for CacheControl { | ||||
| } | ||||
|  | ||||
| /// CacheControl contains a list of these directives. | ||||
| #[deriving(PartialEq, Clone)] | ||||
| #[derive(PartialEq, Clone)] | ||||
| pub enum CacheDirective { | ||||
|     /// "no-cache" | ||||
|     NoCache, | ||||
|   | ||||
| @@ -6,13 +6,13 @@ use header::shared::util::{from_comma_delimited, fmt_comma_delimited}; | ||||
| pub use self::ConnectionOption::{KeepAlive, Close, ConnectionHeader}; | ||||
|  | ||||
| /// The `Connection` header. | ||||
| #[deriving(Clone, PartialEq, Show)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub struct Connection(pub Vec<ConnectionOption>); | ||||
|  | ||||
| deref!(Connection -> Vec<ConnectionOption>); | ||||
|  | ||||
| /// Values that can be in the `Connection` header. | ||||
| #[deriving(Clone, PartialEq)] | ||||
| #[derive(Clone, PartialEq)] | ||||
| pub enum ConnectionOption { | ||||
|     /// The `keep-alive` connection value. | ||||
|     KeepAlive, | ||||
|   | ||||
| @@ -6,7 +6,7 @@ use header::shared::util::from_one_raw_str; | ||||
| /// The `Content-Length` header. | ||||
| /// | ||||
| /// Simply a wrapper around a `uint`. | ||||
| #[deriving(Copy, Clone, PartialEq, Show)] | ||||
| #[derive(Copy, Clone, PartialEq, Show)] | ||||
| pub struct ContentLength(pub uint); | ||||
|  | ||||
| deref!(ContentLength -> uint); | ||||
|   | ||||
| @@ -7,7 +7,7 @@ use mime::Mime; | ||||
| /// | ||||
| /// Used to describe the MIME type of message body. Can be used with both | ||||
| /// requests and responses. | ||||
| #[deriving(Clone, PartialEq, Show)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub struct ContentType(pub Mime); | ||||
|  | ||||
| deref!(ContentType -> Mime); | ||||
|   | ||||
| @@ -13,7 +13,7 @@ use cookie::CookieJar; | ||||
| /// | ||||
| /// > When the user agent generates an HTTP request, the user agent MUST NOT | ||||
| /// > attach more than one Cookie header field. | ||||
| #[deriving(Clone, PartialEq, Show)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub struct Cookies(pub Vec<Cookie>); | ||||
|  | ||||
| //TODO: remove when fixed in libstd | ||||
|   | ||||
| @@ -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. | ||||
| #[deriving(Copy, PartialEq, Clone)] | ||||
| #[derive(Copy, PartialEq, Clone)] | ||||
| pub struct Date(pub Tm); | ||||
|  | ||||
| deref!(Date -> Tm); | ||||
|   | ||||
| @@ -8,7 +8,7 @@ use header::shared::util::from_one_raw_str; | ||||
| /// Preceding the first double quote is an optional weakness indicator, | ||||
| /// which always looks like this: W/ | ||||
| /// See also: https://tools.ietf.org/html/rfc7232#section-2.3 | ||||
| #[deriving(Clone, PartialEq, Show)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub struct Etag { | ||||
|     /// Weakness indicator for the tag | ||||
|     pub weak: bool, | ||||
|   | ||||
| @@ -6,7 +6,7 @@ use header::shared::util::from_one_raw_str; | ||||
| use header::shared::time::tm_from_str; | ||||
|  | ||||
| /// The `Expires` header field. | ||||
| #[deriving(Copy, PartialEq, Clone)] | ||||
| #[derive(Copy, PartialEq, Clone)] | ||||
| pub struct Expires(pub Tm); | ||||
|  | ||||
| deref!(Expires -> Tm); | ||||
|   | ||||
| @@ -10,7 +10,7 @@ use header::shared::util::from_one_raw_str; | ||||
| /// | ||||
| /// Currently is just a String, but it should probably become a better type, | ||||
| /// like url::Host or something. | ||||
| #[deriving(Clone, PartialEq, Show)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub struct Host { | ||||
|     /// The hostname, such a example.domain. | ||||
|     pub hostname: String, | ||||
|   | ||||
| @@ -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. | ||||
| #[deriving(Copy, PartialEq, Clone)] | ||||
| #[derive(Copy, PartialEq, Clone)] | ||||
| pub struct IfModifiedSince(pub Tm); | ||||
|  | ||||
| deref!(IfModifiedSince -> Tm); | ||||
|   | ||||
| @@ -6,7 +6,7 @@ use header::shared::util::from_one_raw_str; | ||||
| use header::shared::time::tm_from_str; | ||||
|  | ||||
| /// The `LastModified` header field. | ||||
| #[deriving(Copy, PartialEq, Clone)] | ||||
| #[derive(Copy, PartialEq, Clone)] | ||||
| pub struct LastModified(pub Tm); | ||||
|  | ||||
| deref!(LastModified -> Tm); | ||||
|   | ||||
| @@ -13,7 +13,7 @@ use header::shared::util::from_one_raw_str; | ||||
| /// | ||||
| /// Currently is just a String, but it should probably become a better type, | ||||
| /// like url::Url or something. | ||||
| #[deriving(Clone, PartialEq, Show)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub struct Location(pub String); | ||||
|  | ||||
| deref!(Location -> String); | ||||
|   | ||||
| @@ -5,7 +5,7 @@ use header::shared::util::from_one_raw_str; | ||||
| /// The `Server` header field. | ||||
| /// | ||||
| /// They can contain any value, so it just wraps a `String`. | ||||
| #[deriving(Clone, PartialEq, Show)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub struct Server(pub String); | ||||
|  | ||||
| deref!(Server -> String); | ||||
|   | ||||
| @@ -10,7 +10,7 @@ use cookie::CookieJar; | ||||
| /// Informally, the Set-Cookie response header contains the header name | ||||
| /// "Set-Cookie" followed by a ":" and a cookie.  Each cookie begins with | ||||
| /// a name-value-pair, followed by zero or more attribute-value pairs. | ||||
| #[deriving(Clone, PartialEq, Show)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub struct SetCookie(pub Vec<Cookie>); | ||||
|  | ||||
| //TODO: remove when fixed in libstd | ||||
|   | ||||
| @@ -18,7 +18,7 @@ use self::Encoding::{Chunked, Gzip, Deflate, Compress, EncodingExt}; | ||||
| /// this header should include `chunked` as the last encoding. | ||||
| /// | ||||
| /// The implementation uses a vector of `Encoding` values. | ||||
| #[deriving(Clone, PartialEq, Show)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub struct TransferEncoding(pub Vec<Encoding>); | ||||
|  | ||||
| deref!(TransferEncoding -> Vec<Encoding>); | ||||
| @@ -33,7 +33,7 @@ deref!(TransferEncoding -> Vec<Encoding>); | ||||
| /// # use hyper::header::Headers; | ||||
| /// # let mut headers = Headers::new(); | ||||
| /// headers.set(TransferEncoding(vec![Gzip, Chunked])); | ||||
| #[deriving(Clone, PartialEq)] | ||||
| #[derive(Clone, PartialEq)] | ||||
| pub enum Encoding { | ||||
|     /// The `chunked` encoding. | ||||
|     Chunked, | ||||
|   | ||||
| @@ -6,13 +6,13 @@ use header::shared::util::{from_comma_delimited, fmt_comma_delimited}; | ||||
| use self::Protocol::{WebSocket, ProtocolExt}; | ||||
|  | ||||
| /// The `Upgrade` header. | ||||
| #[deriving(Clone, PartialEq, Show)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub struct Upgrade(pub Vec<Protocol>); | ||||
|  | ||||
| deref!(Upgrade -> Vec<Protocol>); | ||||
|  | ||||
| /// Protocol values that can appear in the Upgrade header. | ||||
| #[deriving(Clone, PartialEq)] | ||||
| #[derive(Clone, PartialEq)] | ||||
| pub enum Protocol { | ||||
|     /// The websocket protocol. | ||||
|     WebSocket, | ||||
|   | ||||
| @@ -5,7 +5,7 @@ use header::shared::util::from_one_raw_str; | ||||
| /// The `User-Agent` header field. | ||||
| /// | ||||
| /// They can contain any value, so it just wraps a `String`. | ||||
| #[deriving(Clone, PartialEq, Show)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub struct UserAgent(pub String); | ||||
|  | ||||
| deref!(UserAgent -> String); | ||||
|   | ||||
| @@ -5,7 +5,7 @@ use header::shared::util::{from_comma_delimited, fmt_comma_delimited, from_one_r | ||||
| /// The `Allow` header. | ||||
| /// See also https://tools.ietf.org/html/rfc7231#section-7.1.4 | ||||
|  | ||||
| #[deriving(Clone, PartialEq, Show)] | ||||
| #[derive(Clone, PartialEq, Show)] | ||||
| pub enum Vary { | ||||
|     /// This corresponds to '*'. | ||||
|     Any, | ||||
|   | ||||
| @@ -110,7 +110,7 @@ fn header_name<T: Header>() -> &'static str { | ||||
| } | ||||
|  | ||||
| /// A map of header fields on requests and responses. | ||||
| #[deriving(Clone)] | ||||
| #[derive(Clone)] | ||||
| pub struct Headers { | ||||
|     data: HashMap<CaseInsensitive, MuCell<Item>> | ||||
| } | ||||
| @@ -342,7 +342,7 @@ impl<'a> FromIterator<HeaderView<'a>> for Headers { | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[deriving(Clone)] | ||||
| #[derive(Clone)] | ||||
| struct Item { | ||||
|     raw: Option<Vec<Vec<u8>>>, | ||||
|     typed: Option<Box<HeaderFormat + Send + Sync>> | ||||
| @@ -450,7 +450,7 @@ impl fmt::Show for Box<HeaderFormat + Send + Sync> { | ||||
| } | ||||
|  | ||||
| /// Case-insensitive string. | ||||
| //#[deriving(Clone)] | ||||
| //#[derive(Clone)] | ||||
| pub struct CaseInsensitive(SendStr); | ||||
|  | ||||
| impl FromStr for CaseInsensitive { | ||||
| @@ -562,7 +562,7 @@ mod tests { | ||||
|         assert_eq!(accept, Some(Accept(vec![application_vendor, text_plain]))); | ||||
|     } | ||||
|  | ||||
|     #[deriving(Clone, Show)] | ||||
|     #[derive(Clone, Show)] | ||||
|     struct CrazyLength(Option<bool>, uint); | ||||
|  | ||||
|     impl Header for CrazyLength { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user