docs(lib): fix rustdoc warnings

This commit is contained in:
Guillaume Gomez
2017-11-10 19:22:33 +01:00
committed by Sean McArthur
parent fe38aa4bc1
commit e330d30964
55 changed files with 237 additions and 72 deletions

View File

@@ -12,7 +12,8 @@ header! {
/// in-line image /// in-line image
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Accept = #( media-range [ accept-params ] ) /// Accept = #( media-range [ accept-params ] )
/// ///
/// media-range = ( "*/*" /// media-range = ( "*/*"
@@ -40,6 +41,7 @@ header! {
/// ]) /// ])
/// ); /// );
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, Accept, qitem}; /// use hyper::header::{Headers, Accept, qitem};
/// use hyper::mime; /// use hyper::mime;

View File

@@ -12,7 +12,8 @@ header! {
/// those charsets. /// those charsets.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Accept-Charset = 1#( ( charset / "*" ) [ weight ] ) /// Accept-Charset = 1#( ( charset / "*" ) [ weight ] )
/// ``` /// ```
/// ///

View File

@@ -11,7 +11,8 @@ header! {
/// preferred. /// preferred.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Accept-Encoding = #( codings [ weight ] ) /// Accept-Encoding = #( codings [ weight ] )
/// codings = content-coding / "identity" / "*" /// codings = content-coding / "identity" / "*"
/// ``` /// ```

View File

@@ -10,7 +10,8 @@ header! {
/// response. /// response.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Accept-Language = 1#( language-range [ weight ] ) /// Accept-Language = 1#( language-range [ weight ] )
/// language-range = <language-range, see [RFC4647], Section 2.1> /// language-range = <language-range, see [RFC4647], Section 2.1>
/// ``` /// ```
@@ -20,6 +21,7 @@ header! {
/// * `en-us;q=1.0, en;q=0.5, fr` /// * `en-us;q=1.0, en;q=0.5, fr`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, AcceptLanguage, LanguageTag, qitem}; /// use hyper::header::{Headers, AcceptLanguage, LanguageTag, qitem};
/// ///
@@ -33,6 +35,7 @@ header! {
/// ]) /// ])
/// ); /// );
/// ``` /// ```
///
/// ``` /// ```
/// # extern crate hyper; /// # extern crate hyper;
/// # #[macro_use] extern crate language_tags; /// # #[macro_use] extern crate language_tags;

View File

@@ -9,7 +9,8 @@ header! {
/// supports range requests for the target resource. /// supports range requests for the target resource.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Accept-Ranges = acceptable-ranges /// Accept-Ranges = acceptable-ranges
/// acceptable-ranges = 1#range-unit / \"none\" /// acceptable-ranges = 1#range-unit / \"none\"
/// ///
@@ -26,12 +27,14 @@ header! {
/// let mut headers = Headers::new(); /// let mut headers = Headers::new();
/// headers.set(AcceptRanges(vec![RangeUnit::Bytes])); /// headers.set(AcceptRanges(vec![RangeUnit::Bytes]));
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, AcceptRanges, RangeUnit}; /// use hyper::header::{Headers, AcceptRanges, RangeUnit};
/// ///
/// let mut headers = Headers::new(); /// let mut headers = Headers::new();
/// headers.set(AcceptRanges(vec![RangeUnit::None])); /// headers.set(AcceptRanges(vec![RangeUnit::None]));
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, AcceptRanges, RangeUnit}; /// use hyper::header::{Headers, AcceptRanges, RangeUnit};
/// ///
@@ -62,7 +65,8 @@ header! {
/// representation's media type. /// representation's media type.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// range-unit = bytes-unit / other-range-unit /// range-unit = bytes-unit / other-range-unit
/// bytes-unit = "bytes" /// bytes-unit = "bytes"
/// other-range-unit = token /// other-range-unit = token

View File

@@ -13,7 +13,8 @@ use header::{Header, Raw};
/// > match the following ABNF: /// > match the following ABNF:
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Access-Control-Allow-Credentials: "Access-Control-Allow-Credentials" ":" "true" /// Access-Control-Allow-Credentials: "Access-Control-Allow-Credentials" ":" "true"
/// ``` /// ```
/// ///
@@ -25,6 +26,7 @@ use header::{Header, Raw};
/// * "true" /// * "true"
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// # extern crate hyper; /// # extern crate hyper;
/// # fn main() { /// # fn main() {

View File

@@ -9,7 +9,8 @@ header! {
/// during the actual request. /// during the actual request.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Access-Control-Allow-Headers: "Access-Control-Allow-Headers" ":" #field-name /// Access-Control-Allow-Headers: "Access-Control-Allow-Headers" ":" #field-name
/// ``` /// ```
/// ///
@@ -17,6 +18,7 @@ header! {
/// * `accept-language, date` /// * `accept-language, date`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// # extern crate hyper; /// # extern crate hyper;
/// # extern crate unicase; /// # extern crate unicase;
@@ -32,6 +34,7 @@ header! {
/// ); /// );
/// # } /// # }
/// ``` /// ```
///
/// ``` /// ```
/// # extern crate hyper; /// # extern crate hyper;
/// # extern crate unicase; /// # extern crate unicase;

View File

@@ -9,7 +9,8 @@ header! {
/// actual request. /// actual request.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Access-Control-Allow-Methods: "Access-Control-Allow-Methods" ":" #Method /// Access-Control-Allow-Methods: "Access-Control-Allow-Methods" ":" #Method
/// ``` /// ```
/// ///
@@ -17,6 +18,7 @@ header! {
/// * `PUT, DELETE, XMODIFY` /// * `PUT, DELETE, XMODIFY`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, AccessControlAllowMethods}; /// use hyper::header::{Headers, AccessControlAllowMethods};
/// use hyper::Method; /// use hyper::Method;
@@ -26,6 +28,7 @@ header! {
/// AccessControlAllowMethods(vec![Method::Get]) /// AccessControlAllowMethods(vec![Method::Get])
/// ); /// );
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, AccessControlAllowMethods}; /// use hyper::header::{Headers, AccessControlAllowMethods};
/// use hyper::Method; /// use hyper::Method;

View File

@@ -8,10 +8,11 @@ use header::{Header, Raw};
/// ///
/// The `Access-Control-Allow-Origin` header indicates whether a resource /// The `Access-Control-Allow-Origin` header indicates whether a resource
/// can be shared based by returning the value of the Origin request header, /// can be shared based by returning the value of the Origin request header,
/// "*", or "null" in the response. /// `*`, or `null` in the response.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Access-Control-Allow-Origin = "Access-Control-Allow-Origin" ":" origin-list-or-null | "*" /// Access-Control-Allow-Origin = "Access-Control-Allow-Origin" ":" origin-list-or-null | "*"
/// ``` /// ```
/// ///

View File

@@ -8,7 +8,8 @@ header! {
/// API of a CORS API specification. /// API of a CORS API specification.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Access-Control-Expose-Headers = "Access-Control-Expose-Headers" ":" #field-name /// Access-Control-Expose-Headers = "Access-Control-Expose-Headers" ":" #field-name
/// ``` /// ```
/// ///
@@ -16,6 +17,7 @@ header! {
/// * `ETag, Content-Length` /// * `ETag, Content-Length`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// # extern crate hyper; /// # extern crate hyper;
/// # extern crate unicase; /// # extern crate unicase;
@@ -34,6 +36,7 @@ header! {
/// ); /// );
/// # } /// # }
/// ``` /// ```
///
/// ``` /// ```
/// # extern crate hyper; /// # extern crate hyper;
/// # extern crate unicase; /// # extern crate unicase;

View File

@@ -6,14 +6,17 @@ header! {
/// preflight request can be cached in a preflight result cache. /// preflight request can be cached in a preflight result cache.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Access-Control-Max-Age = \"Access-Control-Max-Age\" \":\" delta-seconds /// Access-Control-Max-Age = \"Access-Control-Max-Age\" \":\" delta-seconds
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `531` /// * `531`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, AccessControlMaxAge}; /// use hyper::header::{Headers, AccessControlMaxAge};
/// ///

View File

@@ -9,7 +9,8 @@ header! {
/// during the actual request. /// during the actual request.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Access-Control-Allow-Headers: "Access-Control-Allow-Headers" ":" #field-name /// Access-Control-Allow-Headers: "Access-Control-Allow-Headers" ":" #field-name
/// ``` /// ```
/// ///
@@ -17,6 +18,7 @@ header! {
/// * `accept-language, date` /// * `accept-language, date`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// # extern crate hyper; /// # extern crate hyper;
/// # extern crate unicase; /// # extern crate unicase;
@@ -32,6 +34,7 @@ header! {
/// ); /// );
/// # } /// # }
/// ``` /// ```
///
/// ``` /// ```
/// # extern crate hyper; /// # extern crate hyper;
/// # extern crate unicase; /// # extern crate unicase;

View File

@@ -7,7 +7,8 @@ header! {
/// The `Access-Control-Request-Method` header indicates which method will be /// The `Access-Control-Request-Method` header indicates which method will be
/// used in the actual request as part of the preflight request. /// used in the actual request as part of the preflight request.
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Access-Control-Request-Method: \"Access-Control-Request-Method\" \":\" Method /// Access-Control-Request-Method: \"Access-Control-Request-Method\" \":\" Method
/// ``` /// ```
/// ///
@@ -15,6 +16,7 @@ header! {
/// * `GET` /// * `GET`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, AccessControlRequestMethod}; /// use hyper::header::{Headers, AccessControlRequestMethod};
/// use hyper::Method; /// use hyper::Method;

View File

@@ -9,7 +9,8 @@ header! {
/// with the resource. /// with the resource.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Allow = #method /// Allow = #method
/// ``` /// ```
/// ///
@@ -19,6 +20,7 @@ header! {
/// * `` /// * ``
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, Allow}; /// use hyper::header::{Headers, Allow};
/// use hyper::Method; /// use hyper::Method;
@@ -28,6 +30,7 @@ header! {
/// Allow(vec![Method::Get]) /// Allow(vec![Method::Get])
/// ); /// );
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, Allow}; /// use hyper::header::{Headers, Allow};
/// use hyper::Method; /// use hyper::Method;

View File

@@ -14,7 +14,8 @@ use header::{Header, Raw};
/// agent for the realm of the resource being requested. /// agent for the realm of the resource being requested.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Authorization = credentials /// Authorization = credentials
/// ``` /// ```
/// ///
@@ -23,6 +24,7 @@ use header::{Header, Raw};
/// * `Bearer fpKL54jvWmEGVoRdCNjG` /// * `Bearer fpKL54jvWmEGVoRdCNjG`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, Authorization}; /// use hyper::header::{Headers, Authorization};
/// ///
@@ -42,6 +44,7 @@ use header::{Header, Raw};
/// ) /// )
/// ); /// );
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, Authorization, Bearer}; /// use hyper::header::{Headers, Authorization, Bearer};
/// ///

View File

@@ -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. /// not imply that the same directive is to be given in the response.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Cache-Control = 1#cache-directive /// Cache-Control = 1#cache-directive
/// cache-directive = token [ "=" ( token / quoted-string ) ] /// cache-directive = token [ "=" ( token / quoted-string ) ]
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `no-cache` /// * `no-cache`
/// * `private, community="UCI"` /// * `private, community="UCI"`
/// * `max-age=30` /// * `max-age=30`
@@ -30,6 +32,7 @@ use header::parsing::{from_comma_delimited, fmt_comma_delimited};
/// CacheControl(vec![CacheDirective::MaxAge(86400u32)]) /// CacheControl(vec![CacheDirective::MaxAge(86400u32)])
/// ); /// );
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, CacheControl, CacheDirective}; /// use hyper::header::{Headers, CacheControl, CacheDirective};
/// ///

View File

@@ -59,7 +59,8 @@ header! {
/// message. /// message.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Connection = 1#connection-option /// Connection = 1#connection-option
/// connection-option = token /// connection-option = token
/// ///
@@ -70,12 +71,14 @@ header! {
/// ``` /// ```
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, Connection}; /// use hyper::header::{Headers, Connection};
/// ///
/// let mut headers = Headers::new(); /// let mut headers = Headers::new();
/// headers.set(Connection::keep_alive()); /// headers.set(Connection::keep_alive());
/// ``` /// ```
///
/// ``` /// ```
/// # extern crate hyper; /// # extern crate hyper;
/// # extern crate unicase; /// # extern crate unicase;

View File

@@ -14,7 +14,7 @@ use header::{Header, Raw, parsing};
use header::parsing::{parse_extended_value, http_percent_encode}; use header::parsing::{parse_extended_value, http_percent_encode};
use header::shared::Charset; 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)] #[derive(Clone, Debug, PartialEq)]
pub enum DispositionType { pub enum DispositionType {
/// Inline implies default processing /// Inline implies default processing
@@ -26,7 +26,7 @@ pub enum DispositionType {
Ext(String) Ext(String)
} }
/// A parameter to the disposition type /// A parameter to the disposition type.
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]
pub enum DispositionParam { pub enum DispositionParam {
/// A Filename consisting of a Charset, an optional LanguageTag, and finally a sequence of /// A Filename consisting of a Charset, an optional LanguageTag, and finally a sequence of
@@ -37,7 +37,7 @@ pub enum DispositionParam {
Ext(String, String) 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 /// The Content-Disposition response header field is used to convey
/// additional information about how to process the response payload, and /// 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. /// to use when saving the response payload locally.
/// ///
/// # ABNF /// # ABNF
/// ```plain
/// ```text
/// content-disposition = "Content-Disposition" ":" /// content-disposition = "Content-Disposition" ":"
/// disposition-type *( ";" disposition-parm ) /// disposition-type *( ";" disposition-parm )
/// ///
@@ -66,6 +67,7 @@ pub enum DispositionParam {
/// ``` /// ```
/// ///
/// # Example /// # Example
///
/// ``` /// ```
/// use hyper::header::{Headers, ContentDisposition, DispositionType, DispositionParam, Charset}; /// use hyper::header::{Headers, ContentDisposition, DispositionType, DispositionParam, Charset};
/// ///

View File

@@ -13,20 +13,24 @@ header! {
/// its underlying media type. /// its underlying media type.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Content-Encoding = 1#content-coding /// Content-Encoding = 1#content-coding
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `gzip` /// * `gzip`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, ContentEncoding, Encoding}; /// use hyper::header::{Headers, ContentEncoding, Encoding};
/// ///
/// let mut headers = Headers::new(); /// let mut headers = Headers::new();
/// headers.set(ContentEncoding(vec![Encoding::Chunked])); /// headers.set(ContentEncoding(vec![Encoding::Chunked]));
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, ContentEncoding, Encoding}; /// use hyper::header::{Headers, ContentEncoding, Encoding};
/// ///

View File

@@ -11,15 +11,18 @@ header! {
/// representation. /// representation.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Content-Language = 1#language-tag /// Content-Language = 1#language-tag
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `da` /// * `da`
/// * `mi, en` /// * `mi, en`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// # extern crate hyper; /// # extern crate hyper;
/// # #[macro_use] extern crate language_tags; /// # #[macro_use] extern crate language_tags;
@@ -34,6 +37,7 @@ header! {
/// ); /// );
/// # } /// # }
/// ``` /// ```
///
/// ``` /// ```
/// # extern crate hyper; /// # extern crate hyper;
/// # #[macro_use] extern crate language_tags; /// # #[macro_use] extern crate language_tags;

View File

@@ -22,14 +22,17 @@ use header::{Header, Raw, parsing};
/// > that contains a Transfer-Encoding header field. /// > that contains a Transfer-Encoding header field.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Content-Length = 1*DIGIT /// Content-Length = 1*DIGIT
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `3495` /// * `3495`
/// ///
/// # Example /// # Example
///
/// ``` /// ```
/// use hyper::header::{Headers, ContentLength}; /// use hyper::header::{Headers, ContentLength};
/// ///

View File

@@ -11,11 +11,13 @@ header! {
/// that was content negotiated, created or for the response payload. /// that was content negotiated, created or for the response payload.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Content-Location = absolute-URI / partial-URI /// Content-Location = absolute-URI / partial-URI
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `/hypertext/Overview.html` /// * `/hypertext/Overview.html`
/// * `http://www.example.org/hypertext/Overview.html` /// * `http://www.example.org/hypertext/Overview.html`
/// ///
@@ -27,6 +29,7 @@ header! {
/// let mut headers = Headers::new(); /// let mut headers = Headers::new();
/// headers.set(ContentLocation("/hypertext/Overview.html".to_owned())); /// headers.set(ContentLocation("/hypertext/Overview.html".to_owned()));
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, ContentLocation}; /// use hyper::header::{Headers, ContentLocation};
/// ///

View File

@@ -70,7 +70,8 @@ header! {
/// Content-Range, described in [RFC7233](https://tools.ietf.org/html/rfc7233#section-4.2) /// Content-Range, described in [RFC7233](https://tools.ietf.org/html/rfc7233#section-4.2)
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Content-Range = byte-content-range /// Content-Range = byte-content-range
/// / other-content-range /// / other-content-range
/// ///

View File

@@ -17,15 +17,18 @@ header! {
/// this is an issue, it's possible to implement `Header` on a custom struct. /// this is an issue, it's possible to implement `Header` on a custom struct.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Content-Type = media-type /// Content-Type = media-type
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `text/html; charset=utf-8` /// * `text/html; charset=utf-8`
/// * `application/json` /// * `application/json`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, ContentType}; /// use hyper::header::{Headers, ContentType};
/// ///
@@ -35,6 +38,7 @@ header! {
/// ContentType::json() /// ContentType::json()
/// ); /// );
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, ContentType}; /// use hyper::header::{Headers, ContentType};
/// use hyper::mime; /// use hyper::mime;

View File

@@ -7,14 +7,17 @@ header! {
/// message was originated. /// message was originated.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Date = HTTP-date /// Date = HTTP-date
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `Tue, 15 Nov 1994 08:12:31 GMT` /// * `Tue, 15 Nov 1994 08:12:31 GMT`
/// ///
/// # Example /// # Example
///
/// ``` /// ```
/// use hyper::header::{Headers, Date}; /// use hyper::header::{Headers, Date};
/// use std::time::SystemTime; /// use std::time::SystemTime;

View File

@@ -14,16 +14,19 @@ header! {
/// prefixed by a weakness indicator. /// prefixed by a weakness indicator.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// ETag = entity-tag /// ETag = entity-tag
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `"xyzzy"` /// * `"xyzzy"`
/// * `W/"xyzzy"` /// * `W/"xyzzy"`
/// * `""` /// * `""`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, ETag, EntityTag}; /// use hyper::header::{Headers, ETag, EntityTag};
/// ///

View File

@@ -11,7 +11,8 @@ header! {
/// time. /// time.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Expires = HTTP-date /// Expires = HTTP-date
/// ``` /// ```
/// ///
@@ -19,6 +20,7 @@ header! {
/// * `Thu, 01 Dec 1994 16:00:00 GMT` /// * `Thu, 01 Dec 1994 16:00:00 GMT`
/// ///
/// # Example /// # Example
///
/// ``` /// ```
/// use hyper::header::{Headers, Expires}; /// use hyper::header::{Headers, Expires};
/// use std::time::{SystemTime, Duration}; /// use std::time::{SystemTime, Duration};

View File

@@ -4,13 +4,16 @@ header! {
/// The `From` header field contains an Internet email address for a /// The `From` header field contains an Internet email address for a
/// human user who controls the requesting user agent. The address ought /// human user who controls the requesting user agent. The address ought
/// to be machine-usable. /// to be machine-usable.
///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// From = mailbox /// From = mailbox
/// mailbox = <mailbox, see [RFC5322], Section 3.4> /// mailbox = <mailbox, see [RFC5322], Section 3.4>
/// ``` /// ```
/// ///
/// # Example /// # Example
///
/// ``` /// ```
/// use hyper::header::{Headers, From}; /// use hyper::header::{Headers, From};
/// ///

View File

@@ -17,21 +17,25 @@ header! {
/// there have been any changes to the representation data. /// there have been any changes to the representation data.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// If-Match = "*" / 1#entity-tag /// If-Match = "*" / 1#entity-tag
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `"xyzzy"` /// * `"xyzzy"`
/// * "xyzzy", "r2d2xxxx", "c3piozzzz" /// * "xyzzy", "r2d2xxxx", "c3piozzzz"
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, IfMatch}; /// use hyper::header::{Headers, IfMatch};
/// ///
/// let mut headers = Headers::new(); /// let mut headers = Headers::new();
/// headers.set(IfMatch::Any); /// headers.set(IfMatch::Any);
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, IfMatch, EntityTag}; /// use hyper::header::{Headers, IfMatch, EntityTag};
/// ///

View File

@@ -11,7 +11,8 @@ header! {
/// data has not changed. /// data has not changed.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// If-Unmodified-Since = HTTP-date /// If-Unmodified-Since = HTTP-date
/// ``` /// ```
/// ///
@@ -19,6 +20,7 @@ header! {
/// * `Sat, 29 Oct 1994 19:43:31 GMT` /// * `Sat, 29 Oct 1994 19:43:31 GMT`
/// ///
/// # Example /// # Example
///
/// ``` /// ```
/// use hyper::header::{Headers, IfModifiedSince}; /// use hyper::header::{Headers, IfModifiedSince};
/// use std::time::{SystemTime, Duration}; /// use std::time::{SystemTime, Duration};

View File

@@ -16,11 +16,13 @@ header! {
/// the representation data. /// the representation data.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// If-None-Match = "*" / 1#entity-tag /// If-None-Match = "*" / 1#entity-tag
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `"xyzzy"` /// * `"xyzzy"`
/// * `W/"xyzzy"` /// * `W/"xyzzy"`
/// * `"xyzzy", "r2d2xxxx", "c3piozzzz"` /// * `"xyzzy", "r2d2xxxx", "c3piozzzz"`
@@ -28,12 +30,14 @@ header! {
/// * `*` /// * `*`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, IfNoneMatch}; /// use hyper::header::{Headers, IfNoneMatch};
/// ///
/// let mut headers = Headers::new(); /// let mut headers = Headers::new();
/// headers.set(IfNoneMatch::Any); /// headers.set(IfNoneMatch::Any);
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, IfNoneMatch, EntityTag}; /// use hyper::header::{Headers, IfNoneMatch, EntityTag};
/// ///

View File

@@ -17,21 +17,25 @@ use header::{self, Header, Raw, EntityTag, HttpDate};
/// in Range; otherwise, send me the entire representation. /// in Range; otherwise, send me the entire representation.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// If-Range = entity-tag / HTTP-date /// If-Range = entity-tag / HTTP-date
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `Sat, 29 Oct 1994 19:43:31 GMT` /// * `Sat, 29 Oct 1994 19:43:31 GMT`
/// * `\"xyzzy\"` /// * `\"xyzzy\"`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, IfRange, EntityTag}; /// use hyper::header::{Headers, IfRange, EntityTag};
/// ///
/// let mut headers = Headers::new(); /// let mut headers = Headers::new();
/// headers.set(IfRange::EntityTag(EntityTag::new(false, "xyzzy".to_owned()))); /// headers.set(IfRange::EntityTag(EntityTag::new(false, "xyzzy".to_owned())));
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, IfRange}; /// use hyper::header::{Headers, IfRange};
/// use std::time::{SystemTime, Duration}; /// use std::time::{SystemTime, Duration};

View File

@@ -11,14 +11,17 @@ header! {
/// the user agent does not have an entity-tag for the representation. /// the user agent does not have an entity-tag for the representation.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// If-Unmodified-Since = HTTP-date /// If-Unmodified-Since = HTTP-date
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `Sat, 29 Oct 1994 19:43:31 GMT` /// * `Sat, 29 Oct 1994 19:43:31 GMT`
/// ///
/// # Example /// # Example
///
/// ``` /// ```
/// use hyper::header::{Headers, IfUnmodifiedSince}; /// use hyper::header::{Headers, IfUnmodifiedSince};
/// use std::time::{SystemTime, Duration}; /// use std::time::{SystemTime, Duration};

View File

@@ -10,14 +10,17 @@ header! {
/// conclusion of handling the request. /// conclusion of handling the request.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Expires = HTTP-date /// Expires = HTTP-date
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `Sat, 29 Oct 1994 19:43:31 GMT` /// * `Sat, 29 Oct 1994 19:43:31 GMT`
/// ///
/// # Example /// # Example
///
/// ``` /// ```
/// use hyper::header::{Headers, LastModified}; /// use hyper::header::{Headers, LastModified};
/// use std::time::{SystemTime, Duration}; /// use std::time::{SystemTime, Duration};

View File

@@ -14,7 +14,8 @@ use header::{Header, Raw};
/// [RFC5988](http://tools.ietf.org/html/rfc5988#section-5) /// [RFC5988](http://tools.ietf.org/html/rfc5988#section-5)
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Link = "Link" ":" #link-value /// Link = "Link" ":" #link-value
/// link-value = "<" URI-Reference ">" *( ";" link-param ) /// link-value = "<" URI-Reference ">" *( ";" link-param )
/// link-param = ( ( "rel" "=" relation-types ) /// 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` /// </TheBook/chapter4>; rel="next"; title*=UTF-8'de'n%c3%a4chstes%20Kapitel`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, Link, LinkValue, RelationType}; /// use hyper::header::{Headers, Link, LinkValue, RelationType};
/// ///
@@ -108,7 +110,9 @@ pub struct LinkValue {
} }
/// A Media Descriptors Enum based on: /// 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)] #[derive(Clone, PartialEq, Debug)]
pub enum MediaDesc { pub enum MediaDesc {
/// screen. /// screen.

View File

@@ -8,7 +8,8 @@ header! {
/// status code semantics. /// status code semantics.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Location = URI-reference /// Location = URI-reference
/// ``` /// ```
/// ///
@@ -17,12 +18,14 @@ header! {
/// * `http://www.example.net/index.html` /// * `http://www.example.net/index.html`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, Location}; /// use hyper::header::{Headers, Location};
/// ///
/// let mut headers = Headers::new(); /// let mut headers = Headers::new();
/// headers.set(Location::new("/People.html#tim")); /// headers.set(Location::new("/People.html#tim"));
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, Location}; /// use hyper::header::{Headers, Location};
/// ///

View File

@@ -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. /// 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. /// 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][url], the value of this header is composed of
/// Following the spec, https://fetch.spec.whatwg.org/#origin-header, the value of this header is composed of
/// a String (scheme), header::Host (host/port) /// a String (scheme), header::Host (host/port)
/// ///
/// [url]: https://fetch.spec.whatwg.org/#origin-header
///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, Origin}; /// use hyper::header::{Headers, Origin};
/// ///
@@ -22,6 +24,7 @@ use header::parsing::from_one_raw_str;
/// Origin::new("http", "hyper.rs", None) /// Origin::new("http", "hyper.rs", None)
/// ); /// );
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, Origin}; /// use hyper::header::{Headers, Origin};
/// ///
@@ -30,7 +33,6 @@ use header::parsing::from_one_raw_str;
/// Origin::new("https", "wikipedia.org", Some(443)) /// Origin::new("https", "wikipedia.org", Some(443))
/// ); /// );
/// ``` /// ```
#[derive(PartialEq, Clone, Debug)] #[derive(PartialEq, Clone, Debug)]
pub struct Origin(OriginOrNull); 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; /// use hyper::header::Origin;
/// let origin = Origin::new("https", "foo.com", Some(443)); /// 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}; /// use hyper::header::{Origin,Host};
/// let origin = Origin::new("https", "foo.com", Some(443)); /// let origin = Origin::new("https", "foo.com", Some(443));

View File

@@ -15,15 +15,19 @@ use header::{Header, Raw, parsing};
/// > implementation-specified directives for recipients. This /// > implementation-specified directives for recipients. This
/// > specification deprecates such extensions to improve interoperability. /// > 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 /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, Pragma}; /// use hyper::header::{Headers, Pragma};
/// ///
/// let mut headers = Headers::new(); /// let mut headers = Headers::new();
/// headers.set(Pragma::NoCache); /// headers.set(Pragma::NoCache);
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, Pragma}; /// use hyper::header::{Headers, Pragma};
/// ///

View File

@@ -9,7 +9,8 @@ use header::parsing::{from_comma_delimited, fmt_comma_delimited};
/// behaviors be employed by a server while processing a request. /// behaviors be employed by a server while processing a request.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Prefer = "Prefer" ":" 1#preference /// Prefer = "Prefer" ":" 1#preference
/// preference = token [ BWS "=" BWS word ] /// preference = token [ BWS "=" BWS word ]
/// *( OWS ";" [ OWS parameter ] ) /// *( OWS ";" [ OWS parameter ] )
@@ -22,6 +23,7 @@ use header::parsing::{from_comma_delimited, fmt_comma_delimited};
/// * `wait=30` /// * `wait=30`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, Prefer, Preference}; /// use hyper::header::{Headers, Prefer, Preference};
/// ///
@@ -30,6 +32,7 @@ use header::parsing::{from_comma_delimited, fmt_comma_delimited};
/// Prefer(vec![Preference::RespondAsync]) /// Prefer(vec![Preference::RespondAsync])
/// ); /// );
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, Prefer, Preference}; /// use hyper::header::{Headers, Prefer, Preference};
/// ///

View File

@@ -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. /// honored by the server and applied to the processing of a request.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Preference-Applied = "Preference-Applied" ":" 1#applied-pref /// Preference-Applied = "Preference-Applied" ":" 1#applied-pref
/// applied-pref = token [ BWS "=" BWS word ] /// applied-pref = token [ BWS "=" BWS word ]
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `respond-async` /// * `respond-async`
/// * `return=minimal` /// * `return=minimal`
/// * `wait=30` /// * `wait=30`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, PreferenceApplied, Preference}; /// use hyper::header::{Headers, PreferenceApplied, Preference};
/// ///
@@ -28,6 +31,7 @@ use header::parsing::{from_comma_delimited, fmt_comma_delimited};
/// PreferenceApplied(vec![Preference::RespondAsync]) /// PreferenceApplied(vec![Preference::RespondAsync])
/// ); /// );
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, PreferenceApplied, Preference}; /// use hyper::header::{Headers, PreferenceApplied, Preference};
/// ///

View File

@@ -12,7 +12,8 @@ use header::parsing::{from_one_raw_str};
/// representation data. /// representation data.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Range = byte-ranges-specifier / other-ranges-specifier /// Range = byte-ranges-specifier / other-ranges-specifier
/// other-ranges-specifier = other-range-unit "=" other-range-set /// other-ranges-specifier = other-range-unit "=" other-range-set
/// other-range-set = 1*VCHAR /// other-range-set = 1*VCHAR
@@ -27,6 +28,7 @@ use header::parsing::{from_one_raw_str};
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `bytes=1000-` /// * `bytes=1000-`
/// * `bytes=-2000` /// * `bytes=-2000`
/// * `bytes=0-1,30-40` /// * `bytes=0-1,30-40`
@@ -35,6 +37,7 @@ use header::parsing::{from_one_raw_str};
/// * `custom_unit=xxx-yyy` /// * `custom_unit=xxx-yyy`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, Range, ByteRangeSpec}; /// use hyper::header::{Headers, Range, ByteRangeSpec};
/// ///
@@ -46,6 +49,7 @@ use header::parsing::{from_one_raw_str};
/// headers.clear(); /// headers.clear();
/// headers.set(Range::Unregistered("letters".to_owned(), "a-f".to_owned())); /// headers.set(Range::Unregistered("letters".to_owned(), "a-f".to_owned()));
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, Range}; /// use hyper::header::{Headers, Range};
/// ///

View File

@@ -9,20 +9,24 @@ header! {
/// URI reference, if any, when generating the Referer field value. /// URI reference, if any, when generating the Referer field value.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Referer = absolute-URI / partial-URI /// Referer = absolute-URI / partial-URI
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `http://www.example.org/hypertext/Overview.html` /// * `http://www.example.org/hypertext/Overview.html`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, Referer}; /// use hyper::header::{Headers, Referer};
/// ///
/// let mut headers = Headers::new(); /// let mut headers = Headers::new();
/// headers.set(Referer::new("/People.html#tim")); /// headers.set(Referer::new("/People.html#tim"));
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, Referer}; /// use hyper::header::{Headers, Referer};
/// ///

View File

@@ -14,7 +14,8 @@ use header::{Header, Raw, parsing};
/// protected resource. /// protected resource.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Referrer-Policy: 1#policy-token /// Referrer-Policy: 1#policy-token
/// policy-token = "no-referrer" / "no-referrer-when-downgrade" /// policy-token = "no-referrer" / "no-referrer-when-downgrade"
/// / "same-origin" / "origin" /// / "same-origin" / "origin"
@@ -22,9 +23,11 @@ use header::{Header, Raw, parsing};
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `no-referrer` /// * `no-referrer`
/// ///
/// # Example /// # Example
///
/// ``` /// ```
/// use hyper::header::{Headers, ReferrerPolicy}; /// use hyper::header::{Headers, ReferrerPolicy};
/// ///

View File

@@ -10,7 +10,8 @@ header! {
/// responses. /// responses.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Server = product *( RWS ( product / comment ) ) /// Server = product *( RWS ( product / comment ) )
/// ``` /// ```
/// ///
@@ -18,6 +19,7 @@ header! {
/// * `CERN/3.0 libwww/2.17` /// * `CERN/3.0 libwww/2.17`
/// ///
/// # Example /// # Example
///
/// ``` /// ```
/// use hyper::header::{Headers, Server}; /// use hyper::header::{Headers, Server};
/// ///

View File

@@ -13,7 +13,8 @@ use std::str::from_utf8;
/// a name-value-pair, followed by zero or more attribute-value pairs. /// a name-value-pair, followed by zero or more attribute-value pairs.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// set-cookie-header = "Set-Cookie:" SP set-cookie-string /// set-cookie-header = "Set-Cookie:" SP set-cookie-string
/// set-cookie-string = cookie-pair *( ";" SP cookie-av ) /// set-cookie-string = cookie-pair *( ";" SP cookie-av )
/// cookie-pair = cookie-name "=" cookie-value /// cookie-pair = cookie-name "=" cookie-value
@@ -48,12 +49,14 @@ use std::str::from_utf8;
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `SID=31d4d96e407aad42` /// * `SID=31d4d96e407aad42`
/// * `lang=en-US; Expires=Wed, 09 Jun 2021 10:18:14 GMT` /// * `lang=en-US; Expires=Wed, 09 Jun 2021 10:18:14 GMT`
/// * `lang=; Expires=Sun, 06 Nov 1994 08:49:37 GMT` /// * `lang=; Expires=Sun, 06 Nov 1994 08:49:37 GMT`
/// * `lang=en-US; Path=/; Domain=example.com` /// * `lang=en-US; Path=/; Domain=example.com`
/// ///
/// # Example /// # Example
///
/// ``` /// ```
/// use hyper::header::{Headers, SetCookie}; /// use hyper::header::{Headers, SetCookie};
/// ///

View File

@@ -17,7 +17,7 @@ use header::{Header, Raw, parsing};
/// ///
/// # ABNF /// # ABNF
/// ///
/// ```plain /// ```text
/// [ directive ] *( ";" [ directive ] ) /// [ directive ] *( ";" [ directive ] )
/// ///
/// directive = directive-name [ "=" directive-value ] /// directive = directive-name [ "=" directive-value ]
@@ -27,10 +27,12 @@ use header::{Header, Raw, parsing};
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `max-age=31536000` /// * `max-age=31536000`
/// * `max-age=15768000 ; includeSubDomains` /// * `max-age=15768000 ; includeSubDomains`
/// ///
/// # Example /// # Example
///
/// ``` /// ```
/// # extern crate hyper; /// # extern crate hyper;
/// # fn main() { /// # fn main() {

View File

@@ -13,7 +13,8 @@ header! {
/// so should never appear in this header. /// so should never appear in this header.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// TE = "TE" ":" #( t-codings ) /// TE = "TE" ":" #( t-codings )
/// t-codings = "trailers" | ( transfer-extension [ accept-params ] ) /// t-codings = "trailers" | ( transfer-extension [ accept-params ] )
/// ``` /// ```
@@ -24,6 +25,7 @@ header! {
/// * `` /// * ``
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, Te, Encoding, qitem}; /// use hyper::header::{Headers, Te, Encoding, qitem};
/// ///
@@ -32,6 +34,7 @@ header! {
/// Te(vec![qitem(Encoding::Trailers)]) /// Te(vec![qitem(Encoding::Trailers)])
/// ); /// );
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, Te, Encoding, qitem}; /// use hyper::header::{Headers, Te, Encoding, qitem};
/// ///
@@ -44,6 +47,7 @@ header! {
/// ]) /// ])
/// ); /// );
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, Te, Encoding, QualityItem, q, qitem}; /// use hyper::header::{Headers, Te, Encoding, QualityItem, q, qitem};
/// ///

View File

@@ -17,14 +17,17 @@ header! {
/// > that contains a Transfer-Encoding header field. /// > that contains a Transfer-Encoding header field.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Transfer-Encoding = 1#transfer-coding /// Transfer-Encoding = 1#transfer-coding
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `gzip, chunked` /// * `gzip, chunked`
/// ///
/// # Example /// # Example
///
/// ``` /// ```
/// use hyper::header::{Headers, TransferEncoding, Encoding}; /// use hyper::header::{Headers, TransferEncoding, Encoding};
/// ///

View File

@@ -16,7 +16,8 @@ header! {
/// change. /// change.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Upgrade = 1#protocol /// Upgrade = 1#protocol
/// ///
/// protocol = protocol-name ["/" protocol-version] /// protocol = protocol-name ["/" protocol-version]
@@ -25,15 +26,18 @@ header! {
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11` /// * `HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, Upgrade, Protocol, ProtocolName}; /// use hyper::header::{Headers, Upgrade, Protocol, ProtocolName};
/// ///
/// let mut headers = Headers::new(); /// let mut headers = Headers::new();
/// headers.set(Upgrade(vec![Protocol::new(ProtocolName::WebSocket, None)])); /// headers.set(Upgrade(vec![Protocol::new(ProtocolName::WebSocket, None)]));
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, Upgrade, Protocol, ProtocolName}; /// use hyper::header::{Headers, Upgrade, Protocol, ProtocolName};
/// ///

View File

@@ -11,20 +11,24 @@ header! {
/// unless specifically configured not to do so. /// unless specifically configured not to do so.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// User-Agent = product *( RWS ( product / comment ) ) /// User-Agent = product *( RWS ( product / comment ) )
/// product = token ["/" product-version] /// product = token ["/" product-version]
/// product-version = token /// product-version = token
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `CERN-LineMode/2.15 libwww/2.17b3` /// * `CERN-LineMode/2.15 libwww/2.17b3`
/// * `Bunnies` /// * `Bunnies`
/// ///
/// # Notes /// # Notes
///
/// * The parser does not split the value /// * The parser does not split the value
/// ///
/// # Example /// # Example
///
/// ``` /// ```
/// use hyper::header::{Headers, UserAgent}; /// use hyper::header::{Headers, UserAgent};
/// ///

View File

@@ -11,14 +11,17 @@ header! {
/// (case-insensitive). /// (case-insensitive).
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Vary = "*" / 1#field-name /// Vary = "*" / 1#field-name
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `accept-encoding, accept-language` /// * `accept-encoding, accept-language`
/// ///
/// # Example /// # Example
///
/// ``` /// ```
/// use hyper::header::{Headers, Vary}; /// use hyper::header::{Headers, Vary};
/// ///
@@ -27,6 +30,7 @@ header! {
/// ``` /// ```
/// ///
/// # Example /// # Example
///
/// ``` /// ```
/// # extern crate hyper; /// # extern crate hyper;
/// # extern crate unicase; /// # extern crate unicase;

View File

@@ -11,7 +11,8 @@ use header::parsing::from_one_raw_str;
/// compatible way to notify of a deprecated API. /// compatible way to notify of a deprecated API.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// Warning = 1#warning-value /// Warning = 1#warning-value
/// warning-value = warn-code SP warn-agent SP warn-text /// warning-value = warn-code SP warn-agent SP warn-text
/// [ SP warn-date ] /// [ SP warn-date ]
@@ -25,12 +26,14 @@ use header::parsing::from_one_raw_str;
/// ``` /// ```
/// ///
/// # Example values /// # Example values
///
/// * `Warning: 112 - "network down" "Sat, 25 Aug 2012 23:34:45 GMT"` /// * `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 - "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."`
/// * `Warning: 299 api.hyper.rs:8080 "Deprecated API : use newapi.hyper.rs instead." "Tue, 15 Nov 1994 08:12:31 GMT"` /// * `Warning: 299 api.hyper.rs:8080 "Deprecated API : use newapi.hyper.rs instead." "Tue, 15 Nov 1994 08:12:31 GMT"`
/// ///
/// # Examples /// # Examples
///
/// ``` /// ```
/// use hyper::header::{Headers, Warning}; /// use hyper::header::{Headers, Warning};
/// ///
@@ -44,6 +47,7 @@ use header::parsing::from_one_raw_str;
/// } /// }
/// ); /// );
/// ``` /// ```
///
/// ``` /// ```
/// use hyper::header::{Headers, HttpDate, Warning}; /// use hyper::header::{Headers, HttpDate, Warning};
/// ///
@@ -57,6 +61,7 @@ use header::parsing::from_one_raw_str;
/// } /// }
/// ); /// );
/// ``` /// ```
///
/// ``` /// ```
/// use std::time::SystemTime; /// use std::time::SystemTime;
/// use hyper::header::{Headers, Warning}; /// use hyper::header::{Headers, Warning};

View File

@@ -73,7 +73,8 @@ pub struct ExtendedValue {
/// Extended values are denoted by parameter names that end with `*`. /// Extended values are denoted by parameter names that end with `*`.
/// ///
/// ## ABNF /// ## ABNF
/// ```plain ///
/// ```text
/// ext-value = charset "'" [ language ] "'" value-chars /// ext-value = charset "'" [ language ] "'" value-chars
/// ; like RFC 2231's <extended-initial-value> /// ; like RFC 2231's <extended-initial-value>
/// ; (see [RFC2231], Section 7) /// ; (see [RFC2231], Section 7)
@@ -149,7 +150,9 @@ impl Display for ExtendedValue {
} }
/// Percent encode a sequence of bytes with a character set defined in /// 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 { 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); let encoded = percent_encoding::percent_encode(bytes, self::percent_encoding_http::HTTP_VALUE);
fmt::Display::fmt(&encoded, f) fmt::Display::fmt(&encoded, f)

View File

@@ -9,7 +9,9 @@ use self::Charset::*;
/// ///
/// The string representation is normalised to upper case. /// 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)] #[derive(Clone,Debug,PartialEq)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
pub enum Charset{ pub enum Charset{

View File

@@ -1,10 +1,10 @@
use std::str::FromStr; use std::str::FromStr;
use std::fmt::{self, Display}; use std::fmt::{self, Display};
// check that each char in the slice is either: /// check that each char in the slice is either:
// 1. %x21, or /// 1. `%x21`, or
// 2. in the range %x23 to %x7E, or /// 2. in the range `%x23` to `%x7E`, or
// 3. above %x80 /// 3. above `%x80`
fn check_slice_validity(slice: &str) -> bool { fn check_slice_validity(slice: &str) -> bool {
slice.bytes().all(|c| slice.bytes().all(|c|
c == b'\x21' || (c >= b'\x23' && c <= b'\x7e') | (c >= b'\x80')) 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"`. /// which always looks like `W/`. Examples for valid tags are `"xyzzy"` and `W/"xyzzy"`.
/// ///
/// # ABNF /// # ABNF
/// ```plain ///
/// ```text
/// entity-tag = [ weak ] opaque-tag /// entity-tag = [ weak ] opaque-tag
/// weak = %x57.2F ; "W/", case-sensitive /// weak = %x57.2F ; "W/", case-sensitive
/// opaque-tag = DQUOTE *etagc DQUOTE /// opaque-tag = DQUOTE *etagc DQUOTE