docs(lib): fix rustdoc warnings
This commit is contained in:
		
				
					committed by
					
						 Sean McArthur
						Sean McArthur
					
				
			
			
				
	
			
			
			
						parent
						
							fe38aa4bc1
						
					
				
				
					commit
					e330d30964
				
			| @@ -12,7 +12,8 @@ header! { | ||||
|     /// in-line image | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Accept = #( media-range [ accept-params ] ) | ||||
|     /// | ||||
|     /// media-range    = ( "*/*" | ||||
| @@ -40,6 +41,7 @@ header! { | ||||
|     ///     ]) | ||||
|     /// ); | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, Accept, qitem}; | ||||
|     /// use hyper::mime; | ||||
|   | ||||
| @@ -12,7 +12,8 @@ header! { | ||||
|     /// those charsets. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Accept-Charset = 1#( ( charset / "*" ) [ weight ] ) | ||||
|     /// ``` | ||||
|     /// | ||||
|   | ||||
| @@ -11,7 +11,8 @@ header! { | ||||
|     /// preferred. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Accept-Encoding  = #( codings [ weight ] ) | ||||
|     /// codings          = content-coding / "identity" / "*" | ||||
|     /// ``` | ||||
|   | ||||
| @@ -10,7 +10,8 @@ header! { | ||||
|     /// response. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Accept-Language = 1#( language-range [ weight ] ) | ||||
|     /// language-range  = <language-range, see [RFC4647], Section 2.1> | ||||
|     /// ``` | ||||
| @@ -20,6 +21,7 @@ header! { | ||||
|     /// * `en-us;q=1.0, en;q=0.5, fr` | ||||
|     /// | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, AcceptLanguage, LanguageTag, qitem}; | ||||
|     /// | ||||
| @@ -33,6 +35,7 @@ header! { | ||||
|     ///     ]) | ||||
|     /// ); | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// # extern crate hyper; | ||||
|     /// # #[macro_use] extern crate language_tags; | ||||
|   | ||||
| @@ -9,7 +9,8 @@ header! { | ||||
|     /// supports range requests for the target resource. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Accept-Ranges     = acceptable-ranges | ||||
|     /// acceptable-ranges = 1#range-unit / \"none\" | ||||
|     /// | ||||
| @@ -26,12 +27,14 @@ header! { | ||||
|     /// let mut headers = Headers::new(); | ||||
|     /// headers.set(AcceptRanges(vec![RangeUnit::Bytes])); | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, AcceptRanges, RangeUnit}; | ||||
|     /// | ||||
|     /// let mut headers = Headers::new(); | ||||
|     /// headers.set(AcceptRanges(vec![RangeUnit::None])); | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, AcceptRanges, RangeUnit}; | ||||
|     /// | ||||
| @@ -62,7 +65,8 @@ header! { | ||||
| /// representation's media type. | ||||
| /// | ||||
| /// # ABNF | ||||
| /// ```plain | ||||
| /// | ||||
| /// ```text | ||||
| /// range-unit       = bytes-unit / other-range-unit | ||||
| /// bytes-unit       = "bytes" | ||||
| /// other-range-unit = token | ||||
|   | ||||
| @@ -13,7 +13,8 @@ use header::{Header, Raw}; | ||||
| /// > match the following ABNF: | ||||
| /// | ||||
| /// # ABNF | ||||
| /// ```plain | ||||
| /// | ||||
| /// ```text | ||||
| /// Access-Control-Allow-Credentials: "Access-Control-Allow-Credentials" ":" "true" | ||||
| /// ``` | ||||
| /// | ||||
| @@ -25,6 +26,7 @@ use header::{Header, Raw}; | ||||
| /// * "true" | ||||
| /// | ||||
| /// # Examples | ||||
| /// | ||||
| /// ``` | ||||
| /// # extern crate hyper; | ||||
| /// # fn main() { | ||||
|   | ||||
| @@ -9,7 +9,8 @@ header! { | ||||
|     /// during the actual request. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Access-Control-Allow-Headers: "Access-Control-Allow-Headers" ":" #field-name | ||||
|     /// ``` | ||||
|     /// | ||||
| @@ -17,6 +18,7 @@ header! { | ||||
|     /// * `accept-language, date` | ||||
|     /// | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// # extern crate hyper; | ||||
|     /// # extern crate unicase; | ||||
| @@ -32,6 +34,7 @@ header! { | ||||
|     /// ); | ||||
|     /// # } | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// # extern crate hyper; | ||||
|     /// # extern crate unicase; | ||||
|   | ||||
| @@ -9,7 +9,8 @@ header! { | ||||
|     /// actual request. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Access-Control-Allow-Methods: "Access-Control-Allow-Methods" ":" #Method | ||||
|     /// ``` | ||||
|     /// | ||||
| @@ -17,6 +18,7 @@ header! { | ||||
|     /// * `PUT, DELETE, XMODIFY` | ||||
|     /// | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, AccessControlAllowMethods}; | ||||
|     /// use hyper::Method; | ||||
| @@ -26,6 +28,7 @@ header! { | ||||
|     ///     AccessControlAllowMethods(vec![Method::Get]) | ||||
|     /// ); | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, AccessControlAllowMethods}; | ||||
|     /// use hyper::Method; | ||||
|   | ||||
| @@ -8,10 +8,11 @@ use header::{Header, Raw}; | ||||
| /// | ||||
| /// The `Access-Control-Allow-Origin` header indicates whether a resource | ||||
| /// can be shared based by returning the value of the Origin request header, | ||||
| /// "*", or "null" in the response. | ||||
| /// `*`, or `null` in the response. | ||||
| /// | ||||
| /// # ABNF | ||||
| /// ```plain | ||||
| /// | ||||
| /// ```text | ||||
| /// Access-Control-Allow-Origin = "Access-Control-Allow-Origin" ":" origin-list-or-null | "*" | ||||
| /// ``` | ||||
| /// | ||||
|   | ||||
| @@ -8,7 +8,8 @@ header! { | ||||
|     /// API of a CORS API specification. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Access-Control-Expose-Headers = "Access-Control-Expose-Headers" ":" #field-name | ||||
|     /// ``` | ||||
|     /// | ||||
| @@ -16,6 +17,7 @@ header! { | ||||
|     /// * `ETag, Content-Length` | ||||
|     /// | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// # extern crate hyper; | ||||
|     /// # extern crate unicase; | ||||
| @@ -34,6 +36,7 @@ header! { | ||||
|     /// ); | ||||
|     /// # } | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// # extern crate hyper; | ||||
|     /// # extern crate unicase; | ||||
|   | ||||
| @@ -6,14 +6,17 @@ header! { | ||||
|     /// preflight request can be cached in a preflight result cache. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Access-Control-Max-Age = \"Access-Control-Max-Age\" \":\" delta-seconds | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// # Example values | ||||
|     /// | ||||
|     /// * `531` | ||||
|     /// | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, AccessControlMaxAge}; | ||||
|     /// | ||||
|   | ||||
| @@ -9,7 +9,8 @@ header! { | ||||
|     /// during the actual request. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Access-Control-Allow-Headers: "Access-Control-Allow-Headers" ":" #field-name | ||||
|     /// ``` | ||||
|     /// | ||||
| @@ -17,6 +18,7 @@ header! { | ||||
|     /// * `accept-language, date` | ||||
|     /// | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// # extern crate hyper; | ||||
|     /// # extern crate unicase; | ||||
| @@ -32,6 +34,7 @@ header! { | ||||
|     /// ); | ||||
|     /// # } | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// # extern crate hyper; | ||||
|     /// # extern crate unicase; | ||||
|   | ||||
| @@ -7,7 +7,8 @@ header! { | ||||
|     /// The `Access-Control-Request-Method` header indicates which method will be | ||||
|     /// used in the actual request as part of the preflight request. | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Access-Control-Request-Method: \"Access-Control-Request-Method\" \":\" Method | ||||
|     /// ``` | ||||
|     ///  | ||||
| @@ -15,6 +16,7 @@ header! { | ||||
|     /// * `GET` | ||||
|     ///  | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, AccessControlRequestMethod}; | ||||
|     /// use hyper::Method; | ||||
|   | ||||
| @@ -9,7 +9,8 @@ header! { | ||||
|     /// with the resource. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Allow = #method | ||||
|     /// ``` | ||||
|     /// | ||||
| @@ -19,6 +20,7 @@ header! { | ||||
|     /// * `` | ||||
|     /// | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, Allow}; | ||||
|     /// use hyper::Method; | ||||
| @@ -28,6 +30,7 @@ header! { | ||||
|     ///     Allow(vec![Method::Get]) | ||||
|     /// ); | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, Allow}; | ||||
|     /// use hyper::Method; | ||||
|   | ||||
| @@ -14,7 +14,8 @@ use header::{Header, Raw}; | ||||
| /// agent for the realm of the resource being requested. | ||||
| /// | ||||
| /// # ABNF | ||||
| /// ```plain | ||||
| /// | ||||
| /// ```text | ||||
| /// Authorization = credentials | ||||
| /// ``` | ||||
| /// | ||||
| @@ -23,6 +24,7 @@ use header::{Header, Raw}; | ||||
| /// * `Bearer fpKL54jvWmEGVoRdCNjG` | ||||
| /// | ||||
| /// # Examples | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, Authorization}; | ||||
| /// | ||||
| @@ -42,6 +44,7 @@ use header::{Header, Raw}; | ||||
| ///    ) | ||||
| /// ); | ||||
| /// ``` | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, Authorization, Bearer}; | ||||
| /// | ||||
|   | ||||
| @@ -11,12 +11,14 @@ use header::parsing::{from_comma_delimited, fmt_comma_delimited}; | ||||
| /// not imply that the same directive is to be given in the response. | ||||
| /// | ||||
| /// # ABNF | ||||
| /// ```plain | ||||
| /// | ||||
| /// ```text | ||||
| /// Cache-Control   = 1#cache-directive | ||||
| /// cache-directive = token [ "=" ( token / quoted-string ) ] | ||||
| /// ``` | ||||
| /// | ||||
| /// # Example values | ||||
| /// | ||||
| /// * `no-cache` | ||||
| /// * `private, community="UCI"` | ||||
| /// * `max-age=30` | ||||
| @@ -30,6 +32,7 @@ use header::parsing::{from_comma_delimited, fmt_comma_delimited}; | ||||
| ///     CacheControl(vec![CacheDirective::MaxAge(86400u32)]) | ||||
| /// ); | ||||
| /// ``` | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, CacheControl, CacheDirective}; | ||||
| /// | ||||
|   | ||||
| @@ -59,7 +59,8 @@ header! { | ||||
|     /// message. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Connection        = 1#connection-option | ||||
|     /// connection-option = token | ||||
|     /// | ||||
| @@ -70,12 +71,14 @@ header! { | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, Connection}; | ||||
|     /// | ||||
|     /// let mut headers = Headers::new(); | ||||
|     /// headers.set(Connection::keep_alive()); | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// # extern crate hyper; | ||||
|     /// # extern crate unicase; | ||||
|   | ||||
| @@ -14,7 +14,7 @@ use header::{Header, Raw, parsing}; | ||||
| use header::parsing::{parse_extended_value, http_percent_encode}; | ||||
| use header::shared::Charset; | ||||
|  | ||||
| /// The implied disposition of the content of the HTTP body | ||||
| /// The implied disposition of the content of the HTTP body. | ||||
| #[derive(Clone, Debug, PartialEq)] | ||||
| pub enum DispositionType { | ||||
|     /// Inline implies default processing | ||||
| @@ -26,7 +26,7 @@ pub enum DispositionType { | ||||
|     Ext(String) | ||||
| } | ||||
|  | ||||
| /// A parameter to the disposition type | ||||
| /// A parameter to the disposition type. | ||||
| #[derive(Clone, Debug, PartialEq)] | ||||
| pub enum DispositionParam { | ||||
|     /// A Filename consisting of a Charset, an optional LanguageTag, and finally a sequence of | ||||
| @@ -37,7 +37,7 @@ pub enum DispositionParam { | ||||
|     Ext(String, String) | ||||
| } | ||||
|  | ||||
| /// A `Content-Disposition` header, (re)defined in [RFC6266](https://tools.ietf.org/html/rfc6266) | ||||
| /// A `Content-Disposition` header, (re)defined in [RFC6266](https://tools.ietf.org/html/rfc6266). | ||||
| /// | ||||
| /// The Content-Disposition response header field is used to convey | ||||
| /// additional information about how to process the response payload, and | ||||
| @@ -45,7 +45,8 @@ pub enum DispositionParam { | ||||
| /// to use when saving the response payload locally. | ||||
| /// | ||||
| /// # ABNF | ||||
| /// ```plain | ||||
|  | ||||
| /// ```text | ||||
| /// content-disposition = "Content-Disposition" ":" | ||||
| ///                       disposition-type *( ";" disposition-parm ) | ||||
| /// | ||||
| @@ -66,6 +67,7 @@ pub enum DispositionParam { | ||||
| /// ``` | ||||
| /// | ||||
| /// # Example | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, ContentDisposition, DispositionType, DispositionParam, Charset}; | ||||
| /// | ||||
|   | ||||
| @@ -13,20 +13,24 @@ header! { | ||||
|     /// its underlying media type. | ||||
|     ///  | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Content-Encoding = 1#content-coding | ||||
|     /// ``` | ||||
|     ///  | ||||
|     /// # Example values | ||||
|     /// | ||||
|     /// * `gzip` | ||||
|     /// | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, ContentEncoding, Encoding}; | ||||
|     ///  | ||||
|     /// let mut headers = Headers::new(); | ||||
|     /// headers.set(ContentEncoding(vec![Encoding::Chunked])); | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, ContentEncoding, Encoding}; | ||||
|     ///  | ||||
|   | ||||
| @@ -11,15 +11,18 @@ header! { | ||||
|     /// representation. | ||||
|     ///  | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Content-Language = 1#language-tag | ||||
|     /// ``` | ||||
|     ///  | ||||
|     /// # Example values | ||||
|     /// | ||||
|     /// * `da` | ||||
|     /// * `mi, en` | ||||
|     /// | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// # extern crate hyper; | ||||
|     /// # #[macro_use] extern crate language_tags; | ||||
| @@ -34,6 +37,7 @@ header! { | ||||
|     /// ); | ||||
|     /// # } | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// # extern crate hyper; | ||||
|     /// # #[macro_use] extern crate language_tags; | ||||
|   | ||||
| @@ -22,14 +22,17 @@ use header::{Header, Raw, parsing}; | ||||
| /// > that contains a Transfer-Encoding header field. | ||||
| /// | ||||
| /// # ABNF | ||||
| /// ```plain | ||||
| /// | ||||
| /// ```text | ||||
| /// Content-Length = 1*DIGIT | ||||
| /// ``` | ||||
| /// | ||||
| /// # Example values | ||||
| /// | ||||
| /// * `3495` | ||||
| /// | ||||
| /// # Example | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, ContentLength}; | ||||
| /// | ||||
|   | ||||
| @@ -11,11 +11,13 @@ header! { | ||||
|     /// that was content negotiated, created or for the response payload. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Content-Location = absolute-URI / partial-URI | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// # Example values | ||||
|     /// | ||||
|     /// * `/hypertext/Overview.html` | ||||
|     /// * `http://www.example.org/hypertext/Overview.html` | ||||
|     /// | ||||
| @@ -27,6 +29,7 @@ header! { | ||||
|     /// let mut headers = Headers::new(); | ||||
|     /// headers.set(ContentLocation("/hypertext/Overview.html".to_owned())); | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, ContentLocation}; | ||||
|     /// | ||||
|   | ||||
| @@ -70,7 +70,8 @@ header! { | ||||
| /// Content-Range, described in [RFC7233](https://tools.ietf.org/html/rfc7233#section-4.2) | ||||
| /// | ||||
| /// # ABNF | ||||
| /// ```plain | ||||
| /// | ||||
| /// ```text | ||||
| /// Content-Range       = byte-content-range | ||||
| ///                     / other-content-range | ||||
| /// | ||||
|   | ||||
| @@ -17,15 +17,18 @@ header! { | ||||
|     /// this is an issue, it's possible to implement `Header` on a custom struct. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Content-Type = media-type | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// # Example values | ||||
|     /// | ||||
|     /// * `text/html; charset=utf-8` | ||||
|     /// * `application/json` | ||||
|     /// | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, ContentType}; | ||||
|     /// | ||||
| @@ -35,6 +38,7 @@ header! { | ||||
|     ///     ContentType::json() | ||||
|     /// ); | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, ContentType}; | ||||
|     /// use hyper::mime; | ||||
|   | ||||
| @@ -7,14 +7,17 @@ header! { | ||||
|     /// message was originated. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Date = HTTP-date | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// # Example values | ||||
|     /// | ||||
|     /// * `Tue, 15 Nov 1994 08:12:31 GMT` | ||||
|     /// | ||||
|     /// # Example | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, Date}; | ||||
|     /// use std::time::SystemTime; | ||||
|   | ||||
| @@ -14,16 +14,19 @@ header! { | ||||
|     /// prefixed by a weakness indicator. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// ETag       = entity-tag | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// # Example values | ||||
|     /// | ||||
|     /// * `"xyzzy"` | ||||
|     /// * `W/"xyzzy"` | ||||
|     /// * `""` | ||||
|     /// | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, ETag, EntityTag}; | ||||
|     /// | ||||
|   | ||||
| @@ -11,7 +11,8 @@ header! { | ||||
|     /// time. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Expires = HTTP-date | ||||
|     /// ``` | ||||
|     /// | ||||
| @@ -19,6 +20,7 @@ header! { | ||||
|     /// * `Thu, 01 Dec 1994 16:00:00 GMT` | ||||
|     /// | ||||
|     /// # Example | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, Expires}; | ||||
|     /// use std::time::{SystemTime, Duration}; | ||||
|   | ||||
| @@ -4,13 +4,16 @@ header! { | ||||
|     /// The `From` header field contains an Internet email address for a | ||||
|     /// human user who controls the requesting user agent.  The address ought | ||||
|     /// to be machine-usable. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// From    = mailbox | ||||
|     /// mailbox = <mailbox, see [RFC5322], Section 3.4> | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// # Example | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, From}; | ||||
|     /// | ||||
|   | ||||
| @@ -17,21 +17,25 @@ header! { | ||||
|     /// there have been any changes to the representation data. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// If-Match = "*" / 1#entity-tag | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// # Example values | ||||
|     /// | ||||
|     /// * `"xyzzy"` | ||||
|     /// * "xyzzy", "r2d2xxxx", "c3piozzzz" | ||||
|     /// | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, IfMatch}; | ||||
|     /// | ||||
|     /// let mut headers = Headers::new(); | ||||
|     /// headers.set(IfMatch::Any); | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, IfMatch, EntityTag}; | ||||
|     /// | ||||
|   | ||||
| @@ -11,7 +11,8 @@ header! { | ||||
|     /// data has not changed. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// If-Unmodified-Since = HTTP-date | ||||
|     /// ``` | ||||
|     /// | ||||
| @@ -19,6 +20,7 @@ header! { | ||||
|     /// * `Sat, 29 Oct 1994 19:43:31 GMT` | ||||
|     /// | ||||
|     /// # Example | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, IfModifiedSince}; | ||||
|     /// use std::time::{SystemTime, Duration}; | ||||
|   | ||||
| @@ -16,11 +16,13 @@ header! { | ||||
|     /// the representation data. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// If-None-Match = "*" / 1#entity-tag | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// # Example values | ||||
|     /// | ||||
|     /// * `"xyzzy"` | ||||
|     /// * `W/"xyzzy"` | ||||
|     /// * `"xyzzy", "r2d2xxxx", "c3piozzzz"` | ||||
| @@ -28,12 +30,14 @@ header! { | ||||
|     /// * `*` | ||||
|     /// | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, IfNoneMatch}; | ||||
|     /// | ||||
|     /// let mut headers = Headers::new(); | ||||
|     /// headers.set(IfNoneMatch::Any); | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, IfNoneMatch, EntityTag}; | ||||
|     /// | ||||
|   | ||||
| @@ -17,21 +17,25 @@ use header::{self, Header, Raw, EntityTag, HttpDate}; | ||||
| /// in Range; otherwise, send me the entire representation. | ||||
| /// | ||||
| /// # ABNF | ||||
| /// ```plain | ||||
| /// | ||||
| /// ```text | ||||
| /// If-Range = entity-tag / HTTP-date | ||||
| /// ``` | ||||
| /// | ||||
| /// # Example values | ||||
| /// | ||||
| /// * `Sat, 29 Oct 1994 19:43:31 GMT` | ||||
| /// * `\"xyzzy\"` | ||||
| /// | ||||
| /// # Examples | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, IfRange, EntityTag}; | ||||
| /// | ||||
| /// let mut headers = Headers::new(); | ||||
| /// headers.set(IfRange::EntityTag(EntityTag::new(false, "xyzzy".to_owned()))); | ||||
| /// ``` | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, IfRange}; | ||||
| /// use std::time::{SystemTime, Duration}; | ||||
|   | ||||
| @@ -11,14 +11,17 @@ header! { | ||||
|     /// the user agent does not have an entity-tag for the representation. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// If-Unmodified-Since = HTTP-date | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// # Example values | ||||
|     /// | ||||
|     /// * `Sat, 29 Oct 1994 19:43:31 GMT` | ||||
|     /// | ||||
|     /// # Example | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, IfUnmodifiedSince}; | ||||
|     /// use std::time::{SystemTime, Duration}; | ||||
|   | ||||
| @@ -10,14 +10,17 @@ header! { | ||||
|     /// conclusion of handling the request. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Expires = HTTP-date | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// # Example values | ||||
|     /// | ||||
|     /// * `Sat, 29 Oct 1994 19:43:31 GMT` | ||||
|     /// | ||||
|     /// # Example | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, LastModified}; | ||||
|     /// use std::time::{SystemTime, Duration}; | ||||
|   | ||||
| @@ -14,7 +14,8 @@ use header::{Header, Raw}; | ||||
| /// [RFC5988](http://tools.ietf.org/html/rfc5988#section-5) | ||||
| /// | ||||
| /// # ABNF | ||||
| /// ```plain | ||||
| /// | ||||
| /// ```text | ||||
| /// Link           = "Link" ":" #link-value | ||||
| /// link-value     = "<" URI-Reference ">" *( ";" link-param ) | ||||
| /// link-param     = ( ( "rel" "=" relation-types ) | ||||
| @@ -55,6 +56,7 @@ use header::{Header, Raw}; | ||||
| ///        </TheBook/chapter4>; rel="next"; title*=UTF-8'de'n%c3%a4chstes%20Kapitel` | ||||
| /// | ||||
| /// # Examples | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, Link, LinkValue, RelationType}; | ||||
| /// | ||||
| @@ -108,7 +110,9 @@ pub struct LinkValue { | ||||
| } | ||||
|  | ||||
| /// A Media Descriptors Enum based on: | ||||
| /// https://www.w3.org/TR/html401/types.html#h-6.13 | ||||
| /// [https://www.w3.org/TR/html401/types.html#h-6.13][url] | ||||
| /// | ||||
| /// [url]: https://www.w3.org/TR/html401/types.html#h-6.13 | ||||
| #[derive(Clone, PartialEq, Debug)] | ||||
| pub enum MediaDesc { | ||||
|     /// screen. | ||||
|   | ||||
| @@ -8,7 +8,8 @@ header! { | ||||
|     /// status code semantics. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Location = URI-reference | ||||
|     /// ``` | ||||
|     /// | ||||
| @@ -17,12 +18,14 @@ header! { | ||||
|     /// * `http://www.example.net/index.html` | ||||
|     /// | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, Location}; | ||||
|     /// | ||||
|     /// let mut headers = Headers::new(); | ||||
|     /// headers.set(Location::new("/People.html#tim")); | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, Location}; | ||||
|     /// | ||||
|   | ||||
| @@ -9,11 +9,13 @@ use header::parsing::from_one_raw_str; | ||||
| /// The `Origin` header is a version of the `Referer` header that is used for all HTTP fetches and `POST`s whose CORS flag is set. | ||||
| /// This header is often used to inform recipients of the security context of where the request was initiated. | ||||
| /// | ||||
| /// | ||||
| /// Following the spec, https://fetch.spec.whatwg.org/#origin-header, the value of this header is composed of | ||||
| /// Following the spec, [https://fetch.spec.whatwg.org/#origin-header][url], the value of this header is composed of | ||||
| /// a String (scheme), header::Host (host/port) | ||||
| /// | ||||
| /// [url]: https://fetch.spec.whatwg.org/#origin-header | ||||
| /// | ||||
| /// # Examples | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, Origin}; | ||||
| /// | ||||
| @@ -22,6 +24,7 @@ use header::parsing::from_one_raw_str; | ||||
| ///     Origin::new("http", "hyper.rs", None) | ||||
| /// ); | ||||
| /// ``` | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, Origin}; | ||||
| /// | ||||
| @@ -30,7 +33,6 @@ use header::parsing::from_one_raw_str; | ||||
| ///     Origin::new("https", "wikipedia.org", Some(443)) | ||||
| /// ); | ||||
| /// ``` | ||||
|  | ||||
| #[derive(PartialEq, Clone, Debug)] | ||||
| pub struct Origin(OriginOrNull); | ||||
|  | ||||
| @@ -67,7 +69,8 @@ impl Origin { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /// The scheme, such as http or https | ||||
|     /// The scheme, such as http or https. | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::Origin; | ||||
|     /// let origin = Origin::new("https", "foo.com", Some(443)); | ||||
| @@ -80,7 +83,8 @@ impl Origin { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /// The host, such as Host{hostname: "hyper.rs".to_owned(), port: None} | ||||
|     /// The host, such as `Host { hostname: "hyper.rs".to_owned(), port: None}`. | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Origin,Host}; | ||||
|     /// let origin = Origin::new("https", "foo.com", Some(443)); | ||||
|   | ||||
| @@ -15,15 +15,19 @@ use header::{Header, Raw, parsing}; | ||||
| /// > implementation-specified directives for recipients.  This | ||||
| /// > specification deprecates such extensions to improve interoperability. | ||||
| /// | ||||
| /// Spec: https://tools.ietf.org/html/rfc7234#section-5.4 | ||||
| /// Spec: [https://tools.ietf.org/html/rfc7234#section-5.4][url] | ||||
| /// | ||||
| /// [url]: https://tools.ietf.org/html/rfc7234#section-5.4 | ||||
| /// | ||||
| /// # Examples | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, Pragma}; | ||||
| /// | ||||
| /// let mut headers = Headers::new(); | ||||
| /// headers.set(Pragma::NoCache); | ||||
| /// ``` | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, Pragma}; | ||||
| /// | ||||
|   | ||||
| @@ -9,7 +9,8 @@ use header::parsing::{from_comma_delimited, fmt_comma_delimited}; | ||||
| /// behaviors be employed by a server while processing a request. | ||||
| /// | ||||
| /// # ABNF | ||||
| /// ```plain | ||||
| /// | ||||
| /// ```text | ||||
| /// Prefer     = "Prefer" ":" 1#preference | ||||
| /// preference = token [ BWS "=" BWS word ] | ||||
| ///              *( OWS ";" [ OWS parameter ] ) | ||||
| @@ -22,6 +23,7 @@ use header::parsing::{from_comma_delimited, fmt_comma_delimited}; | ||||
| /// * `wait=30` | ||||
| /// | ||||
| /// # Examples | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, Prefer, Preference}; | ||||
| /// | ||||
| @@ -30,6 +32,7 @@ use header::parsing::{from_comma_delimited, fmt_comma_delimited}; | ||||
| ///     Prefer(vec![Preference::RespondAsync]) | ||||
| /// ); | ||||
| /// ``` | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, Prefer, Preference}; | ||||
| /// | ||||
|   | ||||
| @@ -9,17 +9,20 @@ use header::parsing::{from_comma_delimited, fmt_comma_delimited}; | ||||
| /// honored by the server and applied to the processing of a request. | ||||
| /// | ||||
| /// # ABNF | ||||
| /// ```plain | ||||
| /// | ||||
| /// ```text | ||||
| /// Preference-Applied = "Preference-Applied" ":" 1#applied-pref | ||||
| /// applied-pref = token [ BWS "=" BWS word ] | ||||
| /// ``` | ||||
| /// | ||||
| /// # Example values | ||||
| /// | ||||
| /// * `respond-async` | ||||
| /// * `return=minimal` | ||||
| /// * `wait=30` | ||||
| /// | ||||
| /// # Examples | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, PreferenceApplied, Preference}; | ||||
| /// | ||||
| @@ -28,6 +31,7 @@ use header::parsing::{from_comma_delimited, fmt_comma_delimited}; | ||||
| ///     PreferenceApplied(vec![Preference::RespondAsync]) | ||||
| /// ); | ||||
| /// ``` | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, PreferenceApplied, Preference}; | ||||
| /// | ||||
|   | ||||
| @@ -12,7 +12,8 @@ use header::parsing::{from_one_raw_str}; | ||||
| /// representation data. | ||||
| /// | ||||
| /// # ABNF | ||||
| /// ```plain | ||||
| /// | ||||
| /// ```text | ||||
| /// Range =	byte-ranges-specifier / other-ranges-specifier | ||||
| /// other-ranges-specifier = other-range-unit "=" other-range-set | ||||
| /// other-range-set = 1*VCHAR | ||||
| @@ -27,6 +28,7 @@ use header::parsing::{from_one_raw_str}; | ||||
| /// ``` | ||||
| /// | ||||
| /// # Example values | ||||
| /// | ||||
| /// * `bytes=1000-` | ||||
| /// * `bytes=-2000` | ||||
| /// * `bytes=0-1,30-40` | ||||
| @@ -35,6 +37,7 @@ use header::parsing::{from_one_raw_str}; | ||||
| /// * `custom_unit=xxx-yyy` | ||||
| /// | ||||
| /// # Examples | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, Range, ByteRangeSpec}; | ||||
| /// | ||||
| @@ -46,6 +49,7 @@ use header::parsing::{from_one_raw_str}; | ||||
| /// headers.clear(); | ||||
| /// headers.set(Range::Unregistered("letters".to_owned(), "a-f".to_owned())); | ||||
| /// ``` | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, Range}; | ||||
| /// | ||||
|   | ||||
| @@ -9,20 +9,24 @@ header! { | ||||
|     /// URI reference, if any, when generating the Referer field value. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Referer = absolute-URI / partial-URI | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// # Example values | ||||
|     /// | ||||
|     /// * `http://www.example.org/hypertext/Overview.html` | ||||
|     /// | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, Referer}; | ||||
|     /// | ||||
|     /// let mut headers = Headers::new(); | ||||
|     /// headers.set(Referer::new("/People.html#tim")); | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, Referer}; | ||||
|     /// | ||||
|   | ||||
| @@ -14,7 +14,8 @@ use header::{Header, Raw, parsing}; | ||||
| /// protected resource. | ||||
| /// | ||||
| /// # ABNF | ||||
| /// ```plain | ||||
| /// | ||||
| /// ```text | ||||
| /// Referrer-Policy: 1#policy-token | ||||
| /// policy-token   = "no-referrer" / "no-referrer-when-downgrade" | ||||
| ///                  / "same-origin" / "origin" | ||||
| @@ -22,9 +23,11 @@ use header::{Header, Raw, parsing}; | ||||
| /// ``` | ||||
| /// | ||||
| /// # Example values | ||||
| /// | ||||
| /// * `no-referrer` | ||||
| /// | ||||
| /// # Example | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, ReferrerPolicy}; | ||||
| /// | ||||
|   | ||||
| @@ -10,7 +10,8 @@ header! { | ||||
|     /// responses. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Server = product *( RWS ( product / comment ) ) | ||||
|     /// ``` | ||||
|     /// | ||||
| @@ -18,6 +19,7 @@ header! { | ||||
|     /// * `CERN/3.0 libwww/2.17` | ||||
|     /// | ||||
|     /// # Example | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, Server}; | ||||
|     /// | ||||
|   | ||||
| @@ -13,7 +13,8 @@ use std::str::from_utf8; | ||||
| /// a name-value-pair, followed by zero or more attribute-value pairs. | ||||
| /// | ||||
| /// # ABNF | ||||
| /// ```plain | ||||
| /// | ||||
| /// ```text | ||||
| /// set-cookie-header = "Set-Cookie:" SP set-cookie-string | ||||
| /// set-cookie-string = cookie-pair *( ";" SP cookie-av ) | ||||
| /// cookie-pair       = cookie-name "=" cookie-value | ||||
| @@ -48,12 +49,14 @@ use std::str::from_utf8; | ||||
| /// ``` | ||||
| /// | ||||
| /// # Example values | ||||
| /// | ||||
| /// * `SID=31d4d96e407aad42` | ||||
| /// * `lang=en-US; Expires=Wed, 09 Jun 2021 10:18:14 GMT` | ||||
| /// * `lang=; Expires=Sun, 06 Nov 1994 08:49:37 GMT` | ||||
| /// * `lang=en-US; Path=/; Domain=example.com` | ||||
| /// | ||||
| /// # Example | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, SetCookie}; | ||||
| /// | ||||
|   | ||||
| @@ -17,7 +17,7 @@ use header::{Header, Raw, parsing}; | ||||
| /// | ||||
| /// # ABNF | ||||
| /// | ||||
| /// ```plain | ||||
| /// ```text | ||||
| ///      [ directive ]  *( ";" [ directive ] ) | ||||
| /// | ||||
| ///      directive                 = directive-name [ "=" directive-value ] | ||||
| @@ -27,10 +27,12 @@ use header::{Header, Raw, parsing}; | ||||
| /// ``` | ||||
| /// | ||||
| /// # Example values | ||||
| /// | ||||
| /// * `max-age=31536000` | ||||
| /// * `max-age=15768000 ; includeSubDomains` | ||||
| /// | ||||
| /// # Example | ||||
| /// | ||||
| /// ``` | ||||
| /// # extern crate hyper; | ||||
| /// # fn main() { | ||||
|   | ||||
| @@ -13,7 +13,8 @@ header! { | ||||
|     /// so should never appear in this header. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// TE        = "TE" ":" #( t-codings ) | ||||
|     /// t-codings = "trailers" | ( transfer-extension [ accept-params ] ) | ||||
|     /// ``` | ||||
| @@ -24,6 +25,7 @@ header! { | ||||
|     /// * `` | ||||
|     /// | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, Te, Encoding, qitem}; | ||||
|     /// | ||||
| @@ -32,6 +34,7 @@ header! { | ||||
|     ///     Te(vec![qitem(Encoding::Trailers)]) | ||||
|     /// ); | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, Te, Encoding, qitem}; | ||||
|     /// | ||||
| @@ -44,6 +47,7 @@ header! { | ||||
|     ///     ]) | ||||
|     /// ); | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, Te, Encoding, QualityItem, q, qitem}; | ||||
|     /// | ||||
|   | ||||
| @@ -17,14 +17,17 @@ header! { | ||||
|     /// > that contains a Transfer-Encoding header field. | ||||
|     ///  | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Transfer-Encoding = 1#transfer-coding | ||||
|     /// ``` | ||||
|     ///  | ||||
|     /// # Example values | ||||
|     /// | ||||
|     /// * `gzip, chunked` | ||||
|     ///  | ||||
|     /// # Example | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, TransferEncoding, Encoding}; | ||||
|     ///  | ||||
|   | ||||
| @@ -16,7 +16,8 @@ header! { | ||||
|     /// change. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Upgrade          = 1#protocol | ||||
|     /// | ||||
|     /// protocol         = protocol-name ["/" protocol-version] | ||||
| @@ -25,15 +26,18 @@ header! { | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// # Example values | ||||
|     /// | ||||
|     /// * `HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11` | ||||
|     /// | ||||
|     /// # Examples | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, Upgrade, Protocol, ProtocolName}; | ||||
|     /// | ||||
|     /// let mut headers = Headers::new(); | ||||
|     /// headers.set(Upgrade(vec![Protocol::new(ProtocolName::WebSocket, None)])); | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, Upgrade, Protocol, ProtocolName}; | ||||
|     /// | ||||
|   | ||||
| @@ -11,20 +11,24 @@ header! { | ||||
|     /// unless specifically configured not to do so. | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// User-Agent = product *( RWS ( product / comment ) ) | ||||
|     /// product         = token ["/" product-version] | ||||
|     /// product-version = token | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// # Example values | ||||
|     /// | ||||
|     /// * `CERN-LineMode/2.15 libwww/2.17b3` | ||||
|     /// * `Bunnies` | ||||
|     /// | ||||
|     /// # Notes | ||||
|     /// | ||||
|     /// * The parser does not split the value | ||||
|     /// | ||||
|     /// # Example | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, UserAgent}; | ||||
|     /// | ||||
|   | ||||
| @@ -11,14 +11,17 @@ header! { | ||||
|     /// (case-insensitive). | ||||
|     /// | ||||
|     /// # ABNF | ||||
|     /// ```plain | ||||
|     /// | ||||
|     /// ```text | ||||
|     /// Vary = "*" / 1#field-name | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// # Example values | ||||
|     /// | ||||
|     /// * `accept-encoding, accept-language` | ||||
|     /// | ||||
|     /// # Example | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// use hyper::header::{Headers, Vary}; | ||||
|     /// | ||||
| @@ -27,6 +30,7 @@ header! { | ||||
|     /// ``` | ||||
|     /// | ||||
|     /// # Example | ||||
|     /// | ||||
|     /// ``` | ||||
|     /// # extern crate hyper; | ||||
|     /// # extern crate unicase; | ||||
|   | ||||
| @@ -11,7 +11,8 @@ use header::parsing::from_one_raw_str; | ||||
| /// compatible way to notify of a deprecated API.  | ||||
| /// | ||||
| /// # ABNF | ||||
| /// ```plain | ||||
| /// | ||||
| /// ```text | ||||
| /// Warning       = 1#warning-value | ||||
| /// warning-value = warn-code SP warn-agent SP warn-text | ||||
| ///                                       [ SP warn-date ] | ||||
| @@ -25,12 +26,14 @@ use header::parsing::from_one_raw_str; | ||||
| /// ``` | ||||
| /// | ||||
| /// # Example values | ||||
| /// | ||||
| /// * `Warning: 112 - "network down" "Sat, 25 Aug 2012 23:34:45 GMT"` | ||||
| /// * `Warning: 299 - "Deprecated API " "Tue, 15 Nov 1994 08:12:31 GMT"` | ||||
| /// * `Warning: 299 api.hyper.rs:8080 "Deprecated API : use newapi.hyper.rs instead."` | ||||
| /// * `Warning: 299 api.hyper.rs:8080 "Deprecated API : use newapi.hyper.rs instead." "Tue, 15 Nov 1994 08:12:31 GMT"`  | ||||
| /// | ||||
| /// # Examples | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, Warning}; | ||||
| /// | ||||
| @@ -44,6 +47,7 @@ use header::parsing::from_one_raw_str; | ||||
| ///     } | ||||
| /// ); | ||||
| /// ``` | ||||
| /// | ||||
| /// ``` | ||||
| /// use hyper::header::{Headers, HttpDate, Warning}; | ||||
| /// | ||||
| @@ -57,6 +61,7 @@ use header::parsing::from_one_raw_str; | ||||
| ///     } | ||||
| /// ); | ||||
| /// ``` | ||||
| /// | ||||
| /// ``` | ||||
| /// use std::time::SystemTime; | ||||
| /// use hyper::header::{Headers, Warning}; | ||||
|   | ||||
| @@ -73,7 +73,8 @@ pub struct ExtendedValue { | ||||
| /// Extended values are denoted by parameter names that end with `*`. | ||||
| /// | ||||
| /// ## ABNF | ||||
| /// ```plain | ||||
| /// | ||||
| /// ```text | ||||
| /// ext-value     = charset  "'" [ language ] "'" value-chars | ||||
| ///               ; like RFC 2231's <extended-initial-value> | ||||
| ///               ; (see [RFC2231], Section 7) | ||||
| @@ -149,7 +150,9 @@ impl Display for ExtendedValue { | ||||
| } | ||||
|  | ||||
| /// Percent encode a sequence of bytes with a character set defined in | ||||
| /// https://tools.ietf.org/html/rfc5987#section-3.2 | ||||
| /// [https://tools.ietf.org/html/rfc5987#section-3.2][url] | ||||
| /// | ||||
| /// [url]: https://tools.ietf.org/html/rfc5987#section-3.2 | ||||
| pub fn http_percent_encode(f: &mut fmt::Formatter, bytes: &[u8]) -> fmt::Result { | ||||
|     let encoded = percent_encoding::percent_encode(bytes, self::percent_encoding_http::HTTP_VALUE); | ||||
|     fmt::Display::fmt(&encoded, f) | ||||
|   | ||||
| @@ -9,7 +9,9 @@ use self::Charset::*; | ||||
| /// | ||||
| /// The string representation is normalised to upper case. | ||||
| /// | ||||
| /// See http://www.iana.org/assignments/character-sets/character-sets.xhtml | ||||
| /// See [http://www.iana.org/assignments/character-sets/character-sets.xhtml][url]. | ||||
| /// | ||||
| /// [url]: http://www.iana.org/assignments/character-sets/character-sets.xhtml | ||||
| #[derive(Clone,Debug,PartialEq)] | ||||
| #[allow(non_camel_case_types)] | ||||
| pub enum Charset{ | ||||
|   | ||||
| @@ -1,10 +1,10 @@ | ||||
| use std::str::FromStr; | ||||
| use std::fmt::{self, Display}; | ||||
|  | ||||
| // check that each char in the slice is either: | ||||
| // 1. %x21, or | ||||
| // 2. in the range %x23 to %x7E, or | ||||
| // 3. above %x80 | ||||
| /// check that each char in the slice is either: | ||||
| /// 1. `%x21`, or | ||||
| /// 2. in the range `%x23` to `%x7E`, or | ||||
| /// 3. above `%x80` | ||||
| fn check_slice_validity(slice: &str) -> bool { | ||||
|     slice.bytes().all(|c| | ||||
|         c == b'\x21' || (c >= b'\x23' && c <= b'\x7e') | (c >= b'\x80')) | ||||
| @@ -17,7 +17,8 @@ fn check_slice_validity(slice: &str) -> bool { | ||||
| /// which always looks like `W/`. Examples for valid tags are `"xyzzy"` and `W/"xyzzy"`. | ||||
| /// | ||||
| /// # ABNF | ||||
| /// ```plain | ||||
| /// | ||||
| /// ```text | ||||
| /// entity-tag = [ weak ] opaque-tag | ||||
| /// weak       = %x57.2F ; "W/", case-sensitive | ||||
| /// opaque-tag = DQUOTE *etagc DQUOTE | ||||
|   | ||||
		Reference in New Issue
	
	Block a user