Files
hyper/src/header/common/accept_charset.rs
2015-06-14 21:32:33 -06:00

57 lines
2.0 KiB
Rust

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="```"]
(AcceptCharset, "Accept-Charset") => (QualityItem<Charset>)+
test_accept_charset {
/// Testcase from RFC
test_header!(test1, vec![b"iso-8859-5, unicode-1-1;q=0.8"]);
}
}