Skip to content

Commit

Permalink
Merge pull request #674 from pyfisch/doccomments
Browse files Browse the repository at this point in the history
style(headers): use regular doc-comments inside macros
  • Loading branch information
seanmonstar committed Oct 27, 2015
2 parents d16ef6d + 4c756a9 commit 9cbf549
Show file tree
Hide file tree
Showing 33 changed files with 1,209 additions and 1,209 deletions.
146 changes: 73 additions & 73 deletions src/header/common/accept.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,79 +3,79 @@ use mime::Mime;
use header::QualityItem;

header! {
#[doc="`Accept` header, defined in [RFC7231](http://tools.ietf.org/html/rfc7231#section-5.3.2)"]
#[doc=""]
#[doc="The `Accept` header field can be used by user agents to specify"]
#[doc="response media types that are acceptable. Accept header fields can"]
#[doc="be used to indicate that the request is specifically limited to a"]
#[doc="small set of desired types, as in the case of a request for an"]
#[doc="in-line image"]
#[doc=""]
#[doc="# ABNF"]
#[doc="```plain"]
#[doc="Accept = #( media-range [ accept-params ] )"]
#[doc=""]
#[doc="media-range = ( \"*/*\""]
#[doc=" / ( type \"/\" \"*\" )"]
#[doc=" / ( type \"/\" subtype )"]
#[doc=" ) *( OWS \";\" OWS parameter )"]
#[doc="accept-params = weight *( accept-ext )"]
#[doc="accept-ext = OWS \";\" OWS token [ \"=\" ( token / quoted-string ) ]"]
#[doc="```"]
#[doc=""]
#[doc="# Example values"]
#[doc="* `audio/*; q=0.2, audio/basic` (`*` value won't parse correctly)"]
#[doc="* `text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c`"]
#[doc=""]
#[doc="# Examples"]
#[doc="```"]
#[doc="use hyper::header::{Headers, Accept, qitem};"]
#[doc="use hyper::mime::{Mime, TopLevel, SubLevel};"]
#[doc=""]
#[doc="let mut headers = Headers::new();"]
#[doc=""]
#[doc="headers.set("]
#[doc=" Accept(vec!["]
#[doc=" qitem(Mime(TopLevel::Text, SubLevel::Html, vec![])),"]
#[doc=" ])"]
#[doc=");"]
#[doc="```"]
#[doc="```"]
#[doc="use hyper::header::{Headers, Accept, qitem};"]
#[doc="use hyper::mime::{Mime, TopLevel, SubLevel, Attr, Value};"]
#[doc=""]
#[doc="let mut headers = Headers::new();"]
#[doc="headers.set("]
#[doc=" Accept(vec!["]
#[doc=" qitem(Mime(TopLevel::Application, SubLevel::Json,"]
#[doc=" vec![(Attr::Charset, Value::Utf8)])),"]
#[doc=" ])"]
#[doc=");"]
#[doc="```"]
#[doc="```"]
#[doc="use hyper::header::{Headers, Accept, QualityItem, Quality, qitem};"]
#[doc="use hyper::mime::{Mime, TopLevel, SubLevel};"]
#[doc=""]
#[doc="let mut headers = Headers::new();"]
#[doc=""]
#[doc="headers.set("]
#[doc=" Accept(vec!["]
#[doc=" qitem(Mime(TopLevel::Text, SubLevel::Html, vec![])),"]
#[doc=" qitem(Mime(TopLevel::Application,"]
#[doc=" SubLevel::Ext(\"xhtml+xml\".to_owned()), vec![])),"]
#[doc=" QualityItem::new(Mime(TopLevel::Application, SubLevel::Xml, vec![]),"]
#[doc=" Quality(900)),"]
#[doc=" qitem(Mime(TopLevel::Image,"]
#[doc=" SubLevel::Ext(\"webp\".to_owned()), vec![])),"]
#[doc=" QualityItem::new(Mime(TopLevel::Star, SubLevel::Star, vec![]),"]
#[doc=" Quality(800))"]
#[doc=" ])"]
#[doc=");"]
#[doc="```"]
#[doc=""]
#[doc="# Notes"]
#[doc="* Using always Mime types to represent `media-range` differs from the ABNF."]
#[doc="* **FIXME**: `accept-ext` is not supported."]
/// `Accept` header, defined in [RFC7231](http://tools.ietf.org/html/rfc7231#section-5.3.2)
///
/// The `Accept` header field can be used by user agents to specify
/// response media types that are acceptable. Accept header fields can
/// be used to indicate that the request is specifically limited to a
/// small set of desired types, as in the case of a request for an
/// in-line image
///
/// # ABNF
/// ```plain
/// Accept = #( media-range [ accept-params ] )
///
/// media-range = ( "*/*"
/// / ( type "/" "*" )
/// / ( type "/" subtype )
/// ) *( OWS ";" OWS parameter )
/// accept-params = weight *( accept-ext )
/// accept-ext = OWS ";" OWS token [ "=" ( token / quoted-string ) ]
/// ```
///
/// # Example values
/// * `audio/*; q=0.2, audio/basic` (`*` value won't parse correctly)
/// * `text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c`
///
/// # Examples
/// ```
/// use hyper::header::{Headers, Accept, qitem};
/// use hyper::mime::{Mime, TopLevel, SubLevel};
///
/// let mut headers = Headers::new();
///
/// headers.set(
/// Accept(vec![
/// qitem(Mime(TopLevel::Text, SubLevel::Html, vec![])),
/// ])
/// );
/// ```
/// ```
/// use hyper::header::{Headers, Accept, qitem};
/// use hyper::mime::{Mime, TopLevel, SubLevel, Attr, Value};
///
/// let mut headers = Headers::new();
/// headers.set(
/// Accept(vec![
/// qitem(Mime(TopLevel::Application, SubLevel::Json,
/// vec![(Attr::Charset, Value::Utf8)])),
/// ])
/// );
/// ```
/// ```
/// use hyper::header::{Headers, Accept, QualityItem, Quality, qitem};
/// use hyper::mime::{Mime, TopLevel, SubLevel};
///
/// let mut headers = Headers::new();
///
/// headers.set(
/// Accept(vec![
/// qitem(Mime(TopLevel::Text, SubLevel::Html, vec![])),
/// qitem(Mime(TopLevel::Application,
/// SubLevel::Ext("xhtml+xml".to_owned()), vec![])),
/// QualityItem::new(Mime(TopLevel::Application, SubLevel::Xml, vec![]),
/// Quality(900)),
/// qitem(Mime(TopLevel::Image,
/// SubLevel::Ext("webp".to_owned()), vec![])),
/// QualityItem::new(Mime(TopLevel::Star, SubLevel::Star, vec![]),
/// Quality(800))
/// ])
/// );
/// ```
///
/// # Notes
/// * Using always Mime types to represent `media-range` differs from the ABNF.
/// * **FIXME**: `accept-ext` is not supported.
(Accept, "Accept") => (QualityItem<Mime>)+

test_accept {
Expand Down
92 changes: 46 additions & 46 deletions src/header/common/accept_charset.rs
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
use header::{Charset, QualityItem};

header! {
#[doc="`Accept-Charset` header, defined in"]
#[doc="[RFC7231](http://tools.ietf.org/html/rfc7231#section-5.3.3)"]
#[doc=""]
#[doc="The `Accept-Charset` header field can be sent by a user agent to"]
#[doc="indicate what charsets are acceptable in textual response content."]
#[doc="This field allows user agents capable of understanding more"]
#[doc="comprehensive or special-purpose charsets to signal that capability"]
#[doc="to an origin server that is capable of representing information in"]
#[doc="those charsets."]
#[doc=""]
#[doc="# ABNF"]
#[doc="```plain"]
#[doc="Accept-Charset = 1#( ( charset / \"*\" ) [ weight ] )"]
#[doc="```"]
#[doc=""]
#[doc="# Example values"]
#[doc="* `iso-8859-5, unicode-1-1;q=0.8`"]
#[doc=""]
#[doc="# Examples"]
#[doc="```"]
#[doc="use hyper::header::{Headers, AcceptCharset, Charset, qitem};"]
#[doc=""]
#[doc="let mut headers = Headers::new();"]
#[doc="headers.set("]
#[doc=" AcceptCharset(vec![qitem(Charset::Us_Ascii)])"]
#[doc=");"]
#[doc="```"]
#[doc="```"]
#[doc="use hyper::header::{Headers, AcceptCharset, Charset, Quality, QualityItem};"]
#[doc=""]
#[doc="let mut headers = Headers::new();"]
#[doc="headers.set("]
#[doc=" AcceptCharset(vec!["]
#[doc=" QualityItem::new(Charset::Us_Ascii, Quality(900)),"]
#[doc=" QualityItem::new(Charset::Iso_8859_10, Quality(200)),"]
#[doc=" ])"]
#[doc=");"]
#[doc="```"]
#[doc="```"]
#[doc="use hyper::header::{Headers, AcceptCharset, Charset, qitem};"]
#[doc=""]
#[doc="let mut headers = Headers::new();"]
#[doc="headers.set("]
#[doc=" AcceptCharset(vec![qitem(Charset::Ext(\"utf-8\".to_owned()))])"]
#[doc=");"]
#[doc="```"]
/// `Accept-Charset` header, defined in
/// [RFC7231](http://tools.ietf.org/html/rfc7231#section-5.3.3)
///
/// The `Accept-Charset` header field can be sent by a user agent to
/// indicate what charsets are acceptable in textual response content.
/// This field allows user agents capable of understanding more
/// comprehensive or special-purpose charsets to signal that capability
/// to an origin server that is capable of representing information in
/// those charsets.
///
/// # ABNF
/// ```plain
/// Accept-Charset = 1#( ( charset / "*" ) [ weight ] )
/// ```
///
/// # Example values
/// * `iso-8859-5, unicode-1-1;q=0.8`
///
/// # Examples
/// ```
/// use hyper::header::{Headers, AcceptCharset, Charset, qitem};
///
/// let mut headers = Headers::new();
/// headers.set(
/// AcceptCharset(vec![qitem(Charset::Us_Ascii)])
/// );
/// ```
/// ```
/// use hyper::header::{Headers, AcceptCharset, Charset, Quality, QualityItem};
///
/// let mut headers = Headers::new();
/// headers.set(
/// AcceptCharset(vec![
/// QualityItem::new(Charset::Us_Ascii, Quality(900)),
/// QualityItem::new(Charset::Iso_8859_10, Quality(200)),
/// ])
/// );
/// ```
/// ```
/// use hyper::header::{Headers, AcceptCharset, Charset, qitem};
///
/// let mut headers = Headers::new();
/// headers.set(
/// AcceptCharset(vec![qitem(Charset::Ext("utf-8".to_owned()))])
/// );
/// ```
(AcceptCharset, "Accept-Charset") => (QualityItem<Charset>)+

test_accept_charset {
Expand Down
110 changes: 55 additions & 55 deletions src/header/common/accept_encoding.rs
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
use header::{Encoding, QualityItem};

header! {
#[doc="`Accept-Encoding` header, defined in"]
#[doc="[RFC7231](http://tools.ietf.org/html/rfc7231#section-5.3.4)"]
#[doc=""]
#[doc="The `Accept-Encoding` header field can be used by user agents to"]
#[doc="indicate what response content-codings are"]
#[doc="acceptable in the response. An `identity` token is used as a synonym"]
#[doc="for \"no encoding\" in order to communicate when no encoding is"]
#[doc="preferred."]
#[doc=""]
#[doc="# ABNF"]
#[doc="```plain"]
#[doc="Accept-Encoding = #( codings [ weight ] )"]
#[doc="codings = content-coding / \"identity\" / \"*\""]
#[doc="```"]
#[doc=""]
#[doc="# Example values"]
#[doc="* `compress, gzip`"]
#[doc="* ``"]
#[doc="* `*`"]
#[doc="* `compress;q=0.5, gzip;q=1`"]
#[doc="* `gzip;q=1.0, identity; q=0.5, *;q=0`"]
#[doc=""]
#[doc="# Examples"]
#[doc="```"]
#[doc="use hyper::header::{Headers, AcceptEncoding, Encoding, qitem};"]
#[doc=""]
#[doc="let mut headers = Headers::new();"]
#[doc="headers.set("]
#[doc=" AcceptEncoding(vec![qitem(Encoding::Chunked)])"]
#[doc=");"]
#[doc="```"]
#[doc="```"]
#[doc="use hyper::header::{Headers, AcceptEncoding, Encoding, qitem};"]
#[doc=" "]
#[doc="let mut headers = Headers::new();"]
#[doc="headers.set("]
#[doc=" AcceptEncoding(vec!["]
#[doc=" qitem(Encoding::Chunked),"]
#[doc=" qitem(Encoding::Gzip),"]
#[doc=" qitem(Encoding::Deflate),"]
#[doc=" ])"]
#[doc=");"]
#[doc="```"]
#[doc="```"]
#[doc="use hyper::header::{Headers, AcceptEncoding, Encoding, QualityItem, Quality, qitem};"]
#[doc=" "]
#[doc="let mut headers = Headers::new();"]
#[doc="headers.set("]
#[doc=" AcceptEncoding(vec!["]
#[doc=" qitem(Encoding::Chunked),"]
#[doc=" QualityItem::new(Encoding::Gzip, Quality(600)),"]
#[doc=" QualityItem::new(Encoding::EncodingExt(\"*\".to_owned()), Quality(0)),"]
#[doc=" ])"]
#[doc=");"]
#[doc="```"]
/// `Accept-Encoding` header, defined in
/// [RFC7231](http://tools.ietf.org/html/rfc7231#section-5.3.4)
///
/// The `Accept-Encoding` header field can be used by user agents to
/// indicate what response content-codings are
/// acceptable in the response. An `identity` token is used as a synonym
/// for "no encoding" in order to communicate when no encoding is
/// preferred.
///
/// # ABNF
/// ```plain
/// Accept-Encoding = #( codings [ weight ] )
/// codings = content-coding / "identity" / "*"
/// ```
///
/// # Example values
/// * `compress, gzip`
/// * ``
/// * `*`
/// * `compress;q=0.5, gzip;q=1`
/// * `gzip;q=1.0, identity; q=0.5, *;q=0`
///
/// # Examples
/// ```
/// use hyper::header::{Headers, AcceptEncoding, Encoding, qitem};
///
/// let mut headers = Headers::new();
/// headers.set(
/// AcceptEncoding(vec![qitem(Encoding::Chunked)])
/// );
/// ```
/// ```
/// use hyper::header::{Headers, AcceptEncoding, Encoding, qitem};
///
/// let mut headers = Headers::new();
/// headers.set(
/// AcceptEncoding(vec![
/// qitem(Encoding::Chunked),
/// qitem(Encoding::Gzip),
/// qitem(Encoding::Deflate),
/// ])
/// );
/// ```
/// ```
/// use hyper::header::{Headers, AcceptEncoding, Encoding, QualityItem, Quality, qitem};
///
/// let mut headers = Headers::new();
/// headers.set(
/// AcceptEncoding(vec![
/// qitem(Encoding::Chunked),
/// QualityItem::new(Encoding::Gzip, Quality(600)),
/// QualityItem::new(Encoding::EncodingExt("*".to_owned()), Quality(0)),
/// ])
/// );
/// ```
(AcceptEncoding, "Accept-Encoding") => (QualityItem<Encoding>)*

test_accept_encoding {
Expand Down
Loading

0 comments on commit 9cbf549

Please sign in to comment.