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//!
57//! [feature flags]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section
58
59#[doc(hidden)]
60pub use http;
61
62#[cfg(all(test, feature = "nightly"))]
63extern crate test;
64
65pub use crate::http::{header, Method, Request, Response, StatusCode, Uri, Version};
66
67#[doc(no_inline)]
68pub use crate::http::HeaderMap;
69
70pub use crate::body::Body;
71pub use crate::error::{Error, Result};
72
73#[macro_use]
74mod cfg;
75#[macro_use]
76mod common;
77pub mod body;
78mod error;
79pub mod ext;
80#[cfg(test)]
81mod mock;
82pub mod rt;
83pub mod service;
84pub mod upgrade;
85
86#[cfg(feature = "ffi")]
87pub mod ffi;
88
89cfg_proto! {
90 mod headers;
91 mod proto;
92}
93
94cfg_feature! {
95 #![feature = "client"]
96
97 pub mod client;
98 #[cfg(any(feature = "http1", feature = "http2"))]
99 #[doc(no_inline)]
100 pub use crate::client::Client;
101}
102
103cfg_feature! {
104 #![feature = "server"]
105
106 pub mod server;
107 #[doc(no_inline)]
108 pub use crate::server::Server;
109}
110