refactor(headers): export all headers and utils directly under header

Currently headers are exported at many places. For example you can access
`Transfer-Encoding` header at `header`, `header::common` and
`header::common::transfer_encoding`. Per discussion on IRC with
@seanmonstar and @reem, all contents of headers will be exposed at `header`
directly. Parsing utilities will be exposed at `header::parsing`. Header
macros can now be used from other crates.

This breaks much code using headers. It should use everything it needs
directly from `header::`, encodings are exposed at `header::Encoding::`,
connection options are exposed at `header::ConnectionOption`.
This commit is contained in:
Pyfisch
2015-01-20 13:04:42 +01:00
parent 7a5813b4b2
commit 8d0e5bc302
37 changed files with 223 additions and 272 deletions

View File

@@ -23,13 +23,12 @@ use unicase::UniCase;
use {http, HttpResult};
pub use self::shared::{Encoding, QualityItem, qitem};
pub use self::common::*;
pub use self::shared::*;
/// Common Headers
pub mod common;
pub mod shared;
mod common;
mod shared;
pub mod parsing;
type HeaderName = UniCase<CowString<'static>>;
@@ -237,7 +236,7 @@ impl Headers {
///
/// ```
/// # use hyper::header::Headers;
/// # use hyper::header::common::ContentType;
/// # use hyper::header::ContentType;
/// # let mut headers = Headers::new();
/// let has_type = headers.has::<ContentType>();
/// ```
@@ -515,9 +514,8 @@ mod tests {
use mime::TopLevel::Text;
use mime::SubLevel::Plain;
use unicase::UniCase;
use super::{Headers, Header, HeaderFormat};
use super::common::{ContentLength, ContentType, Accept, Host};
use super::shared::{QualityItem};
use super::{Headers, Header, HeaderFormat, ContentLength, ContentType,
Accept, Host, QualityItem};
use test::Bencher;