hyper/
lib.rs

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