1 #![deny(missing_docs)]
2 #![deny(missing_debug_implementations)]
3 #![cfg_attr(test, deny(rust_2018_idioms))]
4 #![cfg_attr(all(test, feature = "full"), deny(unreachable_pub))]
5 #![cfg_attr(all(test, feature = "full"), deny(warnings))]
6 #![cfg_attr(all(test, feature = "nightly"), feature(test))]
7 #![cfg_attr(docsrs, feature(doc_cfg))]
8 
9 //! # hyper
10 //!
11 //! hyper is a **fast** and **correct** HTTP implementation written in and for Rust.
12 //!
13 //! ## Features
14 //!
15 //! - HTTP/1 and HTTP/2
16 //! - Asynchronous design
17 //! - Leading in performance
18 //! - Tested and **correct**
19 //! - Extensive production use
20 //! - [Client](client/index.html) and [Server](server/index.html) APIs
21 //!
22 //! If just starting out, **check out the [Guides](https://hyper.rs/guides)
23 //! first.**
24 //!
25 //! ## "Low-level"
26 //!
27 //! hyper is a lower-level HTTP library, meant to be a building block
28 //! for libraries and applications.
29 //!
30 //! If looking for just a convenient HTTP client, consider the
31 //! [reqwest](https://crates.io/crates/reqwest) crate.
32 //!
33 //! # Optional Features
34 //!
35 //! hyper uses a set of [feature flags] to reduce the amount of compiled code.
36 //! It is possible to just enable certain features over others. By default,
37 //! hyper does not enable any features but allows one to enable a subset for
38 //! their use case. Below is a list of the available feature flags. You may
39 //! also notice above each function, struct and trait there is listed one or
40 //! more feature flags that are required for that item to be used.
41 //!
42 //! If you are new to hyper it is possible to enable the `full` feature flag
43 //! which will enable all public APIs. Beware though that this will pull in
44 //! many extra dependencies that you may not need.
45 //!
46 //! The following optional features are available:
47 //!
48 //! - `http1`: Enables HTTP/1 support.
49 //! - `http2`: Enables HTTP/2 support.
50 //! - `client`: Enables the HTTP `client`.
51 //! - `server`: Enables the HTTP `server`.
52 //! - `runtime`: Enables convenient integration with `tokio`, providing
53 //!   connectors and acceptors for TCP, and a default executor.
54 //! - `tcp`: Enables convenient implementations over TCP (using tokio).
55 //! - `stream`: Provides `futures::Stream` capabilities.
56 //! - `backports`: 1.0 functionality backported to 0.14.
57 //! - `deprecated`: opt-in to deprecation warnings to prepare you for 1.0.
58 //!
59 //! [feature flags]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section
60 
61 #[doc(hidden)]
62 pub use http;
63 
64 #[cfg(all(test, feature = "nightly"))]
65 extern crate test;
66 
67 pub use crate::http::{header, Method, Request, Response, StatusCode, Uri, Version};
68 
69 #[doc(no_inline)]
70 pub use crate::http::HeaderMap;
71 
72 pub use crate::body::Body;
73 pub use crate::error::{Error, Result};
74 
75 #[macro_use]
76 mod cfg;
77 #[macro_use]
78 mod common;
79 pub mod body;
80 mod error;
81 pub mod ext;
82 #[cfg(test)]
83 mod mock;
84 pub mod rt;
85 pub mod service;
86 pub mod upgrade;
87 
88 #[cfg(feature = "ffi")]
89 pub mod ffi;
90 
91 cfg_proto! {
92     mod headers;
93     mod proto;
94 }
95 
96 cfg_feature! {
97     #![feature = "client"]
98 
99     pub mod client;
100     #[cfg(any(feature = "http1", feature = "http2"))]
101     #[doc(no_inline)]
102     pub use crate::client::Client;
103 }
104 
105 cfg_feature! {
106     #![feature = "server"]
107 
108     pub mod server;
109     #[doc(no_inline)]
110     pub use crate::server::Server;
111 }
112